SyntaxFix
Write A Post
Hire A Developer
Questions
You need to push i
i
var yearStart = 2000; var yearEnd = 2040; var arr = []; for (var i = yearStart; i < yearEnd+1; i++) { arr.push(i); }
Then, your resulting array will be:
arr = [2000, 2001, 2003, ... 2039, 2040]
Hope this helps