Skip to content

Instantly share code, notes, and snippets.

@devdays
Created December 9, 2014 00:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devdays/3789ab968fe6173ed175 to your computer and use it in GitHub Desktop.
Save devdays/3789ab968fe6173ed175 to your computer and use it in GitHub Desktop.
Object JavaScript - Use call to establish context for this
function sayHello(){
alert(this.message);
}
var obj = {
message : "hello"
};
setTimeout(function(){sayHello.call(obj)}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment