loading...

re: This and Bind In Javascript VIEW POST

FULL DISCUSSION
 
const protagonist = {
  name: 'Mario',
  announce() {
    return this.name
  }
}

const ourHero = protagonist.announce.bind(protagonist)

console.log(ourHero()) //returns Maro

Something is wrong, on my computer it returns Mario!

 

Yep it's supposed to!

 

No, I am joking at your typo.

// returns Maro 
Code of Conduct Report abuse