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
Alternatively, you can try out Learneroo before signing up.