Last active
March 31, 2018 11:38
-
-
Save haidarafif0809/6eadf0f5d20e227a626083f37a826f34 to your computer and use it in GitHub Desktop.
This file contains 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
class Car { | |
constructor(type, color) { | |
this.type = type | |
this.color = color | |
this.engineStatus = 'off' | |
} | |
engineStart () { | |
this.engineStatus = 'on' | |
console.log('engine start') | |
} | |
engingeStop () { | |
this.engineStatus = 'off' | |
console.log('engine start') | |
} | |
static isEngineOn (car) { | |
if (car.engineStatus === 'on') { | |
console.log('Engine On') | |
} else { | |
console.log('Engine off') | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment