Created
July 25, 2019 17:48
-
-
Save abhikulshrestha22/a4071094c6ef59d7c41977f4e9435990 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
var fruit1 = { | |
name: 'Apple', | |
quantity: 2, | |
} | |
function getString(name1, name2, name3) { | |
return `${name1}, ${name2} and ${name3} have ${this.quantity} ${this.name} remaining` | |
} | |
// creates a new function newGetString | |
var newGetString = getString.bind(fruit1,'jane','john','abraham'); | |
console.log(newGetString()) | |
// jane, john and abraham have 2 Apple remaining |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment