Answers for "How to get only values by using value method in javascript from a nested object?"

0

How to get only values by using value method in javascript 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 getValues = Object.values(person); //use values method on object
console.log(getValues);
//Expected output:

/*
[
  'labib',
  22,
  'web-developer',
  [ 'ahsik', 'abir', 'alvi', 'hanafi' ],
  { firstChild: 'Salman', secondChild: 'Rafi', thirdChild: 'Anfi' }
]
*/
Posted by: Guest on September-11-2021

Code answers related to "How to get only values by using value method in javascript from a nested object?"

Code answers related to "Javascript"

Browse Popular Code Answers by Language