javascript
Get all keys from an object using Javascript
You can use Object.keys() method to get all keys from an object. It will return the array of key names.
var obj = {
"name": "Ankit",
"username": "ankit01",
"status": "active",
"contact": "mail"
};
var all_keys = Object.keys(obj);
Output
["name","username","status","contact"]
Live Demo
Was this helpful?
Similar Posts
- Javascript to convert all object keys to lowercase
- Get number of keys in an object Javascript
- Lodash - object keys conversion to lowercase
- Get all values as array items from an Object in Javascript
- How to Check if Arrays in a Object Are All Empty
- Access object properties using with() function in Javascript(ES6)
- Filter an Array using object key value in Javascript