object get key code example
Example 1: js get object keys
myObject = {
"key": "value"
}
Object.keys(myObject); // get array of keys
Example 2: js object keys
var myObj = {no:'u',my:'sql'}
var keys = Object.keys(myObj);//returnes the array ['no','my'];
Example 3: get keys of object js
var buttons = {
foo: 'bar',
fiz: 'buz'
};
for ( var property in buttons ) {
console.log( property ); // Outputs: foo, fiz or fiz, foo
}
Example 4: how to get keys in an object javascript
Object.keys(whateverYourObjectIsCalled)