Last active
February 20, 2020 02:29
-
-
Save jasminegmp/06963ada9654a20c80f5391c6c52297d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let john = { | |
name: 'John' | |
} | |
let hobbies = ['painting', 'cooking', 'biking']; | |
let setName = function(hobby0, hobby1){ | |
console.log(this.name + "'s hobbies are " + hobby0 + " and " + hobby1); | |
} | |
let myFunction = setName.bind(john, hobbies[0], hobbies[1]); | |
//as of here, nothing will be output because this myFunction is a function return | |
myFunction(); //this is when the output will be "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