For
for (condition; end condition; change) {
// do it, do it now
}for (let i = 0; i < 10; i = i + 1) {
// do this code ten-times
}for (key in object) {
// code block to be executed
}const person = {fname:"John", lname:"Doe", age:25};
let info = "";
for (let x in person) {
info += person[x];
}
// Result: info = "JohnDoe25"
const numbers = [45, 4, 9, 16, 25];
let txt = "";
for (let x in numbers) {
txt += numbers[x];
}
// Result: txt = '45491625'Last updated