Tell us what’s happening:
i do some search, Methods returning a value.
therefore,why return can’t be used in this case?
if i take return away, the code can be work?
thank you for answer>< Your code so far
// Setup
var myArray = [];
// Only change code below this line
for(var i=1;i<=5;i++){
return myArray.push(i);
}
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36.
That will just return on the first iteration of the for loop. It will exit whatever function is there. That push method doesn’t need to return. What do you think the return is doing?