scrimba
Object Oriented Programming in JavaScript
Create a Method on an Object
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Create a Method on an Object
AboutCommentsNotes
Create a Method on an Object
Expand for more info
index.js
run
preview
console
// Questions? contact me on Twitter:
// @the_brianb

// freeCodeCamp challenge: https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/object-oriented-programming/create-a-method-on-an-object

let duck = {
name: 'Bob',
numLegs: 2,
sayName: function() {
console.log("The name of this duck is " + duck.name + ".");
return "The name of this duck is " + duck.name + ".";
}
}

// duck.sayName();

// let dog = {
// name: 'Piper',
// numLegs: 4
// }

console.log("");
Console
""
,
index.html
-3:10