let array = [1, 2, 3, 4, 5]; for (let i = 0; i < array.length; i++) { console.log(array[i]); } let j = 0; while(j < array.length) { console.log(array[j]); j++; } for(let value of array) { console.log(value) } for(let key in array) { console.log(array[key]) } array.forEach(num => console.log(num));
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