- script.js
JavaScript
var usersByDay = [4, 2, 1, 3];
console.log(usersByDay);
Result
Goalscompleted
- At the end of the program, add a variable
currentIndexwith a zero value. - Then add a loop that counts
jfromcurrentIndex + 1tousersByDay.length - 1inclusive. Increasejby one after each iteration. - Inside the loop, log the value of the j-th element of the array in the console.
Comments