1

Consider the following code snippet function oddsums(n) { let total = 0, result=[]; for(let x = 1; x <= n; x++) { let odd = 2*x-1; total += odd; result.push(total); } return result; } What would be the output if oddsums(5); is executed afted the above code snippet ?

Correct Answer: Returns [1,4,9,16,25]

Make the most of this question

This page focuses on one JavaScript MCQs question from Programming. After checking the answer, return to the topic list to practice more or run a timed set.