java script Arrays and Objects - FORIN , FOR OF
let aa= [12,14,15,16];
let bb = [22,33,44,55,66];
for(aaa in aa){
console.log(aaa);
}
// let cc= aa.concat(bb);
// console.log(cc);
// cc.splice(6,1);
// console.log(cc);
let obj = [{
id :123,
name:'sudheer'
},
{
id :100723,
name:'myra'
}];
//console.log(obj[0].id);
for(value in obj){
if(obj[value].id=== 100723){
console.log('Found the value ',obj[value].id);
}else
console.log('the value is outside',obj[value].id);
}
indureddy@Bindus-MBP js-basics % node concat.js
the value is outside 123
Found the value 100723
bindureddy@Bindus-MBP js-basics % node concat.js
0
1
2
3
the value is outside 123
Found the value 100723
bindureddy@Bindus-MBP js-basics %
Comments
Post a Comment