Skip to content

Instantly share code, notes, and snippets.

@rrameshbtech
Created July 30, 2018 01:34
Show Gist options
  • Save rrameshbtech/2fca286e439f1812a914b40d2ad01f44 to your computer and use it in GitHub Desktop.
Save rrameshbtech/2fca286e439f1812a914b40d2ad01f44 to your computer and use it in GitHub Desktop.
function printSpeciality() {
console.log(`${this.city} is know for ${this.speciality}`);
}
const printKarurSpeciality = printSpeciality.bind({city: 'Karur', speciality: 'Textile Industries'});
printKarurSpeciality(); // Karur is know for Textile Industries
const printCoimbatoreSpeciality = printSpeciality.bind({city: 'Coimbatore', speciality: 'Mechanical Industries'});
printCoimbatoreSpeciality(); // Coimbatore is know for Mechanical Industries
const printTirupurSpeciality = printCoimbatoreSpeciality.bind({
city: 'Tirupur',
speciality: 'Textile Industries'
}); // Already bound function can not be overridden
printTirupurSpeciality(); // Coimbatore is know for Mechanical Industries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment