Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var fruit1 = {
name: 'Apple',
quantity: 2,
getString: function(){
// this refers to the object fruit1.
return `${this.quantity} ${this.name} remaining`
}
}
console.log(fruit1.getString())
// "2 Apple remaining"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment