Programming noob here. Found this question on codewars: "Complete the function that takes a non-negative integer n as input, and returns a list of all the powers of 2 with the exponent ranging from 0 to n (inclusive)."
function powersOfTwo(n){
var myArray = [];
for (var i=0; i<=n; i++){
return myArray.push(2**i);
}
return myArray
}
Im confused as to why this doesn't work. This is probably a noob question, but i started last week