let images = document.body.querySelectorAll(`img`);
document.addEventListener(`keydown`, event => {
let index = +String.fromCharCode(event.which) - 1;
if (index < 5) {
images[index].style.display = `block`;
}
}, false);
for (let i = 0; i < arr.length; i += 1) {
// some code
}
for (let i = 0, length = arr.length; i < length; i += 1) {
// some code
}
for (let i = arr.length; i > 0; i -= 1) {
// some code
}
let i = 0;
while (i < arr.length) {
// some code
i++;
}
Array.prototype.forEach.call(arr, item => {
// some code
});
for (let item of arr) {
// some code
}