react spa app and objects
This commit is contained in:
parent
4a76e9c9d2
commit
340fd0f151
21 changed files with 20252 additions and 2 deletions
14
eloquentjavascript/06_Objects/obj.js
Normal file
14
eloquentjavascript/06_Objects/obj.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
function speak(line){
|
||||
console.log(`The ${this.type} rabbit says '${line}'`)
|
||||
}
|
||||
|
||||
let whiteRabbit = {
|
||||
type: "white", speak
|
||||
};
|
||||
|
||||
let hungryRabbit = {
|
||||
type: "hungry", speak
|
||||
};
|
||||
whiteRabbit.speak("Oh my fur and whiskers");
|
||||
|
||||
hungryRabbit.speak("Got any carrots?");
|
Loading…
Add table
Add a link
Reference in a new issue