Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Case if aren't allowed to use Math.pow() :
- const pow = (num, times) => {
- let total = 1
- for (let i=0; i < times; i++) {
- total *= num
- }
- return total
- }
- // console.log(pow(<arg>, <raise>))
- console.log(pow(3, 8)) // 8*8*8 = 512
Advertisement
Add Comment
Please, Sign In to add comment