Last active
July 8, 2020 06:34
-
-
Save gpDA/f005b7fa20aa30808917d9f3aa177c2f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var carFactory = new VehicleFactory(); | |
| var car = carFactory.createVehicle({ | |
| vehicleType: "car", | |
| color: "yellow", | |
| doors: 6, | |
| }); | |
| console.log(car instanceof Car); // true | |
| console.log(car); // Car object of color "yellow", doors: 6 in a "brand new" state | |
| var movingTruck = carFactory.createVehicle({ | |
| vehicleType: "truck", | |
| state: "like new", | |
| color: "red", | |
| wheelSize: "small" | |
| }); | |
| console.log(movingTruck instanceof Truck); // true | |
| console.log(movingTruck); // Truck object of color "red", a "like new" state and a "small" wheelSize |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment