let classMarks = [62,88,90,70,69,85]; for (i=classMarks.length-1; i >= 0; i--) { console.log(classMarks[i]); } // outputs each element reversed for (let number of classMarks) { console.log(number); } // outputs each element classMarks.forEach(function(number) { console.log(number+2); }); // adds 2 to each number and outputs it let counter = 0; let j = 0; while (counter <= 4) { console.log(classMarks[j]); counter ++; j++ } // outputs the first 5 elements in the array
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter