Challenge for Object Functions, Constructors and Prototypes
Create 10 cars, where each car has a
number. The cars should be numbered in order from 0 to 9. The cars from 0 to 4 should be colored "green" and the cars from 5 to 9 should be colored "blue". Place the cars in order in an array called
To avoid duplicate code when creating 10 separate cars, first first create a constructor function
Car that takes
number parameters and sets them to
this.number. Then create 10 cars and place them in a
Please sign in or sign up to submit answers.
Alternatively, you can try out Learneroo before signing up.