How to get only property names/keys from a nested object
const person = {
name: 'labib',
age: 22,
job: 'web-developer',
frieds: ['ahsik', 'abir', 'alvi', 'hanafi'],
childList: {
firstChild: 'Salman',
secondChild: 'Rafi',
thirdChild: 'Anfi'
}
}
const getKeys = Object.keys(person); //use keys method on object
console.log(getKeys)
//Expected output:
//[ 'name', 'age', 'job', 'frieds', 'childList' ]