mirror of
https://github.com/c0de-archive/hacktoberfest-2018.git
synced 2024-12-22 13:22:39 +00:00
19 lines
407 B
JavaScript
19 lines
407 B
JavaScript
|
class Beer {
|
||
|
constructor(name = 'Dulcetti', beerName = 'Karmeliet') {
|
||
|
this.name = name;
|
||
|
this.beerName = beerName;
|
||
|
}
|
||
|
|
||
|
sayHello() {
|
||
|
console.info(`Hello, ${ this.name }. Do you wanna a ${ this.beerName }?`)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Hello with modified infos
|
||
|
const myInfos = new Beer('Bruno', 'Duvel');
|
||
|
myInfos.sayHello();
|
||
|
|
||
|
// Hello with default infos
|
||
|
const defaultBeer = new Beer();
|
||
|
defaultBeer.sayHello();
|