lundi 31 mars 2014

why what keyword this references in these 2 situation is different?


Vote count:

0






  1. var object1 = {name: "my object", ha: function() { return this;} }


    object1.ha() returns Object {name: "my object", ha: function}




  2. var object2 = {name: "my object2", ha2: function() { return function() { return this} } }


    object2.ha()() returns window





asked 1 min ago

Will

26





Aucun commentaire:

Enregistrer un commentaire