I can iterate over an object like this:
var obj = {name: "Fred"}
for(var value in obj) {
// Key should be "name"
console.log(key + ": " + value);
}
How can I find out what key is? Is this possible at all? Any help would be appreciated.
Hope this will be helpful
var obj = {name: "Fred"}
for(var key in obj) {
// Key should be "name"
console.log(key + ": " + obj[key]);
}