Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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' ]
Comment

PREVIOUS NEXT
Code Example
Javascript :: react show new app 
Javascript :: x is not a function javascript type error 
Javascript :: module missing for arearange highcharts react 
Javascript :: how to remove comma from toString function javascript 
Javascript :: convert path string to url encoding javascript 
Javascript :: why in the hell does JavaScript - Date getMonth() return 11 
Javascript :: rest framework and json 
Javascript :: peopleToSendMessage 
Javascript :: trackpad scrolling detected multiple times 
Javascript :: avascript-how-to-detect-if-a-word-is-highlighted 
Javascript :: React Readonly rating 
Javascript :: get call log in react native with filter android 
Javascript :: nestjs mongoose ClassSerializerInterceptor not working 
Javascript :: getelementbyid without the <script 
Javascript :: add remove to array vue js 
Javascript :: yup password match 
Javascript :: Spread Syntax for array literals or strings 
Javascript :: Failed: Template parse errors: There is no directive with "exportAs" set to "ngModel" karma 
Javascript :: filter-vs-map-reactjs-and-jsx 
Javascript :: error-too-many-re-renders-react-limits-the-number-of-renders-to-prevent 
Javascript :: Reading manifest: Warning processing Description: An unexpected property was found in the WebExtension manifest. 
Javascript :: sending string variable to .net mvc using Ajax JQuery 
Javascript :: angular material slide effect button click 
Javascript :: node and bash together 
Javascript :: markdown config 
Javascript :: vue js destroyed 
Javascript :: objection eager loading 
Javascript :: isPalindrome 
Javascript :: openai giving me a 401 
Javascript :: make a table of data from db in jsp 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =