Created
May 18, 2018 15:18
-
-
Save meech-ward/465fad00a9f3718bc6f97e3457102b61 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 Banana { | |
constructor () { | |
this.ripeness = 0; | |
} | |
age() { | |
this.ripeness++; | |
} | |
report() { | |
if (this.ripeness === 7) { | |
console.log("hmn, delicious"); | |
} else if (this.ripeness > 7) { | |
console.log("brown, unfit for consumption, suitable for muffins"); | |
} else if (this.ripeness < 7) { | |
console.log("ew, crunchy"); | |
} else { | |
console.log("this cannot happen"); | |
} | |
} | |
} | |
let b1 = new Banana(); | |
setInterval(b1.age, 1000); | |
setInterval(b1.report, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment