The Power Plant

Medium+20 XP

Mission Briefing

A solar flare knocked out the Math module! The shield generators need power calculations instantly, and you must rapidly recreate the exponent engine from scratch using raw iteration.

The Concept: Looping Logic

Exponentiation (like 2 to the power of 3) is just multiplying a base number by itself a specific number of times. This is the exact definition of a loop!

The Objective

Your function receives a base and an exp (exponent).

  1. Return the result of raising base to the power of exp.
  2. Do not use Math.pow() or the ** operator. You must use a loop to repeatedly multiply an accumulator.
  3. Example: base 2, exp 3 -> 2 * 2 * 2 = 8.

Constraints

    CoreLoops
    JavaScript
    Loading...
    3 Hidden

    Input Arguments

    base2
    exp3

    Expected Output

    8

    Click RUN to test your solution