Skip to content

Instantly share code, notes, and snippets.

@bdtomlin
Created June 29, 2012 16:02
Show Gist options
  • Save bdtomlin/3018817 to your computer and use it in GitHub Desktop.
Save bdtomlin/3018817 to your computer and use it in GitHub Desktop.
HomeWork 1
var CARS = [
{ color: 'blue', make: 'BMW' },
{ color: 'red', make: 'Ferrari' }
];
var logCar = function(car){
console.log("I'm a " + car['color'] + ' ' + car['make'])
}
function Car(make, color){
this.log = function(){
console.log("I'm a " + color + ' ' + make)
};
}
var carsLength = CARS.length;
for(i=0;i < carsLength; i++){
(new Car(CARS[i].make, CARS[i].color)).log();
logCar(CARS[i]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment