react spa app and objects

This commit is contained in:
Geir Okkenhaug Jerstad 2024-09-30 11:18:07 +02:00
parent 4a76e9c9d2
commit 340fd0f151
21 changed files with 20252 additions and 2 deletions

View 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?");