Prototype?
UNDERSTATNDING OF PROTOTYPE
function Car(model, brand){ this.model = model; this.brand = brand; } var spark = new Car('spark', 'chevrolet'); var i40 = new Car('i40', 'Hyundai'); Car.prototype.ride = function(){ console.log('vroom!' + this.model) };
Class?
class Car { constructor(model, brand) { this.model = model; this.brand = brand; } var avante = new Car('avante', 'Hyundai') }
CSS (0) | 2019.04.16 |
---|---|
Asynchronous Call - Javascript (0) | 2019.04.16 |
Function methods (call, apply, bind) - Javascript (0) | 2019.04.16 |
this의 적용 (0) | 2019.04.15 |
Closure Module Pattern (0) | 2019.04.15 |
댓글 영역