How to access multiple properties in an object in JavaScript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to access multiple properties in an object in JavaScript

How to access multiple properties in an object in JavaScript

31st May 2018, 7:29 AM
tsx0x100
tsx0x100 - avatar
1 Answer
+ 8
obj={ name:"bob",age:5} var props= Object.getOwnPropertyNames(obj); with these you can get all the properties of obj. alert(obj); //name,age
31st May 2018, 8:22 AM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar