//Eloquent Javascript Objects snippet 2

//Eloquent Javascript Objects snippet 2 function speak(line) { console.log("The " + this.type + " rabbit says '" + line + "'"); } var whiteRabbit = {type: "white", speak: speak}; var fatRabbit = {type: "fat", speak: speak}; whiteRabbit.speak("Oh my ears and whiskers, " + "how late it's getting!"); fatRabbit.speak("I could sure use a carrot right now.");

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.