This is probably a simple problem but I need to create the JavaScript equivalent to N instances of a ‘class’ whose state must be totally separate.
like:
var car = new Car('Ford');
var car = new Car('Toyota');
How can I achieve this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use an array object to store them:
You can iterate over all the stored instances using a
forloop: