How to get all property values of an object as an array in Node.js

1 Answer

0 votes
const obj = {
    id: 187207,
    name: "Albert Einstein",
    academicrank: "Professor"
};
 
const valueArray = Object.values(obj);
 
console.log(valueArray);
 
 
   
     
     
/*
run:
 
[ 187207, 'Albert Einstein', 'Professor' ]
     
*/

 



answered Jul 5, 2022 by avibootz

Related questions

1 answer 125 views
1 answer 126 views
1 answer 124 views
1 answer 125 views
1 answer 132 views
...