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 143 views
1 answer 151 views
1 answer 137 views
1 answer 150 views
1 answer 150 views
...