cploutarchou
2/5/2020 - 3:26 PM

for loop by ES Version

for loop by ES Version

//ES5

for (var i = 0; i < boxesArr5.length; i++) {
}

// ES6
for (const e of boxesArray6){

}

question.set('question', 'What is the official name of latest major Javascript version');
question.set(1, 'ES5');
question.set(2, 'ES6');
question.set(3, 'ES2015');
question.set(4, 'ES7');
question.set('correct', 3);
question.set(true, 'Correct Answer');
question.set(false, 'Wrong, Please try again!');

for (let [key, value] of question.entries()) {
    if (typeof (key) === "number") {
        console.log(`Answer ${key} : ${value}`);
    }
}