Math.pow(x, y); // Returns x raised to the power y
function solution(n) {
if (n === 1) {
return true;
}
for (let i = 2; i < n; i++) {
let power = i;
while (power < n) {
power *= i;
}
if (power === n) {
return true;
}
}
return false;
}
base ** exponent