JavaScript: Sum 1..5 #1
Ready — edit the code above and click Run.
console.log([...Array(5)].reduce((a,_,k)=>a+k+1,0));
Try solving on your own first, then reveal the official answer.
Array methods are core to JS interviews.