diff --git a/bike-shop/src/stage2-constructors.js b/bike-shop/src/stage2-constructors.js index c422386..b52ede6 100644 --- a/bike-shop/src/stage2-constructors.js +++ b/bike-shop/src/stage2-constructors.js @@ -1,17 +1,48 @@ -function Bike() { - // your code here +function Bike(name, price) { + alert(new.target); + this.name = name + this.price = price + this.rings = [3, 7] + this.brakes = { + back : true, + front : true + }, + this.tires = [new Tire, new Tire] + this.frame = new Frame } -function Frame() { - // your code here +function Frame(color, size, style) { + this.color = color ? color : "black" + this.size = size ? size : 55 + this.style = style ? style : "street" } -function Tire() { - // your code here +function Tire(diameter, type) { + this.diameter = diameter ? diameter : 22 + this.type = type ? type : 'street' + this.rings = [2, 5] } + module.exports = { Bike: Bike, Frame: Frame, Tire: Tire } + + + + +const myFrame = new Frame() +//myFrame.color = "black" +//myFrame.size = 55 +//myFrame.style = "street" + +const myBike = new Bike() +//myBike.name = "" +//myBike.price = "" +//myBike.tires = ["front", "back"] + +const myTire = new Tire() +//myTire.diameter = "" +//myTire.type = "" diff --git a/index.html b/index.html index 086ca1a..d873de8 100644 --- a/index.html +++ b/index.html @@ -5,6 +5,6 @@