JS Class Objects | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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 Answer
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