How to get all property values of an object as an array in TypeScript

1 Answer

0 votes
const obj = {
    id: 900371,
    name: "R2D2",
    academicrank: "Dr"
};
 
const valueArray = Object.values(obj);
 
console.log(valueArray);
 
 
   
     
     
/*
run:
 
[900371, "R2D2", "Dr"] 
     
*/

 



answered Jul 5, 2022 by avibootz

Related questions

1 answer 134 views
1 answer 141 views
1 answer 129 views
1 answer 145 views
1 answer 141 views
...