Didart

Even Powers of 2

Apr 2nd, 2022
1,193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function evenPowersOf2(input) {
  2.     let digit = Number(input[0]);
  3.  
  4.     for (let index = 0; index <= digit; index += 2) {
  5.         let result = Math.pow(2, index)
  6.         console.log(result);
  7.     }
  8. }
  9. evenPowersOf2(["3"])
Advertisement
Add Comment
Please, Sign In to add comment