I am trying to find 11 power of n. I know in JavaScript there is a function Math.pow which give you power of number.I want to implement that function by own.my function is working perfectly , but its time complexity is O(n) can we reduce that time complexity using any other method?
I am thinking to use bit map, but not getting success.
function power(x,n) {
let sum =1
for(let i =0;i<n;i++){
sum*=x
}
return sum
}
console.log(power(11,3))