I am using this code
var obj = { 'name':'Some Person Name',
'country':'Country of Some Person',
'age':1
}
var storeVal = Object.keys(obj)
for (var i = 0; i < storeVal.length; i++) {
var storeLoop = storeVal[i] ;
document.write('<pre>'+storeLoop+'</pre>');
}
Now I can display the keys of object obj using above code and I also know how to display values of object obj using Object.values(). I want to know how I can display the whole object obj using above for loop and I am not talking about for..in loop. I want to also know how to display the specific key and value,for example if I want to display only name key and its value,how that can be done ? I am only using JavaScript. No jquery.
for-inloop, but then you use constructs that provide nearly the same semantics asfor-in. Why is that?for..inloop in my entire learning since I started learning JavaScript. I do not know about the constructs offor..in, I just want to understand onlyforloop properly and then I'll go for variations likefor..in. I am just freaking clearing my concepts properly.forproperly, that's great, but that has nothing to do with enumerating objects.