let arry = {
name: "Rakibul Islam",
class: "Tane",
grup: "A",
roll: 10,
sub: "Arse"
}
//for in loop used to object
for(let i in arry){
console.log(i,arry[i]);
}
let items = ['beef', 'cabbage', 'javascript']; // Defines a list of items
for (let item of items) { // Defines for loop with a variable of 'item'
console.log(item); // Prints the item that is found
}
let arry = {
name: "Rakibul Islam",
class: "Tane",
grup: "A",
roll: 10,
sub: "Arse"
}
//for in loop used to object
for(let i in arry){
console.log(i,arry[i]);
}
var car = {"Tesla":"Model 3", "Mercedes":"V-8 Model"};
for(brandName in car){
console.log(brandName);
}
//Tesla
//Mercedes
for(brandName in car){
console.log(car[brandName]);
}
//Model 3
//V-8 Model
const user ={
name:'Shirshak',
age:25,
subscibers:200,
money:'lolno'
}
for(let x in user){
console.log(user[x]) //name,age,subscriber and money(only get key not value)
}
let list = ["a", "b", "c"];
// for in
for (let i in list) {
// i is index
console.log(i); // "0", "1", "2",
console.log(list[i]); // "a", "b", "c"
}
// for of
for (let i of list) {
// i is value
console.log(i); // "a", "b", "c"
}