var garage = [];
var Car = function (color, price){
this.color = color;
this.price = price;
return this;
}
// 伝えたいところはココ
Car.prototype.isNew = function (){
this.isNew = true;
return this;
};
var old_car = new Car("red", 10000000);
garage.push(old_car);
var new_car = new Car("blue", 100000000).isNew();
garage.push(new_car);
function searchNewCarsFromGarage (){
var new_cars = [];
for ( car_num in garage ){
if (garage[car_num]. hasOwnProperty("isNew")){
new_cars.push(garage[car_num]);
}
return new_cars;
}