- Use object.keys(objectName) method to get access to all the keys of object.
- Now, we can use indexing like Object.keys(objectName) to get the key of first element of object.
Example: This example illustrate the above approach.
- After running it one time, break it. Then we will get the first key of the Object.
Example: This example illustrates the above approach.