Skip to content

Instantly share code, notes, and snippets.

@Arieg419
Created December 26, 2016 23:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arieg419/03cb4d3ddb67637c370105bdef394fe2 to your computer and use it in GitHub Desktop.
Save Arieg419/03cb4d3ddb67637c370105bdef394fe2 to your computer and use it in GitHub Desktop.
var pokemon = {
firstname: 'Pika',
lastname: 'Chu ',
getPokeName: function() {
var fullname = this.firstname + ' ' + this.lastname;
return fullname;
}
};
var pokemonName = function(snack, hobby) {
console.log(this.getPokeName() + ' loves ' + snack + ' and ' + hobby);
};
pokemonName.call(pokemon,'sushi', 'algorithms'); // Pika Chu loves sushi and algorithms
pokemonName.apply(pokemon,['sushi', 'algorithms']); // Pika Chu loves sushi and algorithms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment