how to get keys of object in js 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 all keys of object in javascript
myObject = {
"key": "value",
"key2":"value2"
}
Object.keys(myObject);
//console.log(Object.keys(myObject)) = ["key", "key2"]