Problem Solving

Problems Name

a To The Power b

                
                    function aToThePowerB(a, b) {
                        // return a ** b;
                        let sum = 1;
                        for (i = 0; i < b; i++) {
                            sum = sum * a;
                        }
                        return sum;
                    }
                    console.log(aToThePowerB(3, 2)); // 9
                    console.log(aToThePowerB(5, 3)); // 125
                    console.log(aToThePowerB(2, 7)); // 128