Quick actions

cmd+k|ctrl+k

Navigation

Languages

javascript, Dicoding

Snippet info

Language

JavaScript

Visibility

public

Author

wildanidam

Created

2020-05-10T17:47:31Z

Updated

2020-05-10T17:47:31Z

function Car(manufacture, color) {
    this.manufacture = manufacture;
    this.color = color;
    this.enginesActive = false;
}
 
Car.prototype.startEngines = function () {
    console.log('Mobil dinyalakan...');
    this.enginesActive = true;
};
 
Car.prototype.info = function () {
    console.log("Manufacture: " + this.manufacture);
    console.log("Color: " + this.color);
    console.log("Engines: " + (this.enginesActive ? "Active" : "Inactive"));
}
 
var johnCar = new Car("Honda", "Red");
johnCar.startEngines();
johnCar.info()
INFO