Guest User

Untitled

a guest
Jan 18th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. var wizard = {
  2. schoolName: 'Hogwarts',
  3. headMaster: 'Professor Dumbeldore ',
  4. getWizardName: function(firstname, lastname) {
  5. var fullname = firstname + ' ' + lastname;
  6. return fullname;
  7. },
  8. getSchoolNameAndHeadMaster: function(){
  9. return this.headMaster + " will be your headMaster at "+ this.schoolName
  10. }
  11.  
  12. };
  13.  
  14. var diagonAlly = function(favoriteSpell, wizardingHouse, firstname, lastname) {
  15. console.log(this.getWizardName(firstname, lastname) + ' Welcome to Hogwarts!!!');
  16. console.log(this.getWizardName(firstname, lastname) + '\'s favorite spell is ' + favoriteSpell + ' and is sorted to ' + wizardingHouse + ' house');
  17. console.log(this.getSchoolNameAndHeadMaster())
  18. };
  19.  
  20. var welcomeWizard = diagonAlly.bind(wizard);
  21.  
  22. welcomeWizard('Expecto Petronum','Griffindor', 'Harry', 'Potter');
  23. welcomeWizard('Wingardum Leviosa','Griffindor', 'Hermoine', 'Graneger');
  24. welcomeWizard('Crucify','Slytherin', 'Draco', 'Malfoy');
Add Comment
Please, Sign In to add comment