Skip to content

Instantly share code, notes, and snippets.

@jasminegmp
Last active February 20, 2020 02:29
Show Gist options
  • Save jasminegmp/a58221686fb488d2e994c18d0a79c44c to your computer and use it in GitHub Desktop.
Save jasminegmp/a58221686fb488d2e994c18d0a79c44c to your computer and use it in GitHub Desktop.
let john = {
name: 'John'
}
let hobbies = ['painting', 'cooking', 'biking'];
let setName = function(hobby0, hobby1){
console.log(this.name + "'s hobbies are " + hobby0 + " and " + hobby1);
}
setName.apply(john, hobbies);
// will output "John's hobbies are painting and cooking"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment