Created
November 26, 2018 12:36
-
-
Save ragmha/853236fdd897787a1081356a90df733d 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
class Pizza { | |
name: string; | |
toppings: string[] = []; | |
constructor(name: string) { | |
this.name = name; | |
} | |
addTopping(topping: string) { | |
this.toppings.push(topping); | |
} | |
} | |
const pizza = new Pizza("Pepperoni"); | |
pizza.addTopping("pepperoni"); | |
console.log(pizza); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment