How to get the length of an object in TypeScript

1 Answer

0 votes
const obj = {
  id: 3832912,
  name: "tim",
  language: "typescript"
};

const len = Object.keys(obj).length;

console.log(len); 



      
/*
run:
      
3
      
*/

 



answered May 28, 2022 by avibootz

Related questions

1 answer 208 views
1 answer 202 views
2 answers 323 views
2 answers 253 views
1 answer 252 views
1 answer 236 views
...