

MCQOPTIONS
Saved Bookmarks
1. |
Consider the following code snippetfunction 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 ifoddsums(5)is executed afted the above code snippet ? |
A. | eturns [1,4,9,16,25] |
B. | eturns [1,2,3,4,5] |
C. | eturns [3,6,9,12,15] |
D. | eturns [1,3,5,7,9] |
Answer» B. eturns [1,2,3,4,5] | |