Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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');
Add Comment
Please, Sign In to add comment