Skip to content

Instantly share code, notes, and snippets.

@vishivish18
Created January 18, 2019 08:40
Show Gist options
  • Select an option

  • Save vishivish18/fc942201f6b29a49f050a54017669d60 to your computer and use it in GitHub Desktop.

Select an option

Save vishivish18/fc942201f6b29a49f050a54017669d60 to your computer and use it in GitHub Desktop.
var wizard = {
schoolName: 'Hogwarts',
headMaster: 'Professor Dumbeldore ',
getWizardName: function(firstname, lastname) {
var fullname = firstname + ' ' + lastname;
return fullname;
},
getSchoolNameAndHeadMaster: function(){
return this.headMaster + " will be your headMaster at "+ this.schoolName
}
};
var diagonAlly = function(favoriteSpell, wizardingHouse, firstname, lastname) {
console.log(this.getWizardName(firstname, lastname) + ' Welcome to Hogwarts!!!');
console.log(this.getWizardName(firstname, lastname) + '\'s favorite spell is ' + favoriteSpell + ' and is sorted to ' + wizardingHouse + ' house');
console.log(this.getSchoolNameAndHeadMaster())
};
var welcomeWizard = diagonAlly.bind(wizard);
welcomeWizard('Expecto Petronum','Griffindor', 'Harry', 'Potter');
welcomeWizard('Wingardum Leviosa','Griffindor', 'Hermoine', 'Graneger');
welcomeWizard('Crucify','Slytherin', 'Draco', 'Malfoy');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment