JS Class Objects | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

JS Class Objects

So I may be over thinking this but is there an easy way to store or access all the ā€œNewā€ Class Objects created. Iā€™d like to store it in another object or something of the sort. Iā€™m just looking for an easy way to iterate through Class Objects and the data within those objects if anyone can help with that. Iā€™ve tried creating another object to try the push() Method but I get an undefined error on those class objects Iā€™ve created. Thanks in advance.

29th Jul 2021, 12:30 AM
Anthony Johnson
Anthony Johnson - avatar
1 Resposta
0
Thanks for the help. I actually ended up using another object like this var myObject = { Obj1: new Classā€¦.. } Im sure an array will work in pretty much the same way. I just like using dot notation better in my particular case. I have alot of different named properties and to me its just a bit easier naming it than saying [0].
29th Jul 2021, 3:50 AM
Anthony Johnson
Anthony Johnson - avatar