How to find object length in TypeScript

1 Answer

0 votes
const obj = {
  id: 123,
  name: "tom",
  salary: 12900,
  work: true,
  room: 'A'
}
 
console.log(Object.keys(obj).length); 
  
 
   
     
     
/*
run:
     
5
 
*/

 



answered Feb 24, 2022 by avibootz
...