How to get an object key by index in Node.js

1 Answer

0 votes
const obj = {
  id: 383912,
  name: "tim",
  language: "nodejs"
};
  
console.log(Object.keys(obj)[0]); 
console.log(Object.keys(obj)[1]); 

    
      
      
      
/*
run:
      
id
name
      
*/

 



answered May 28, 2022 by avibootz

Related questions

1 answer 126 views
1 answer 163 views
1 answer 94 views
1 answer 140 views
1 answer 129 views
...