Skip to main content

Understanding JavaScript's this keyword - Trephine

Popularity Report

Total Popularity Score: 0

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Rank

URL Tag Cloud

Bookmark History

Saved by 2 people (0 private), first by anonymouse user on 2009-03-19


Public Sticky notes

var unboundGreet = Bob.greet;
unboundGreet();

What do we expect unboundGreet() to produce? The answer is "Hi, my name is ". The reason is that this is set to the window global when an unbound function is called

Highlighted by benxshen