Skip to content

Instantly share code, notes, and snippets.

@ericpkatz
Created June 10, 2015 22:53
Show Gist options
  • Save ericpkatz/1f07974e76acd4b9ae96 to your computer and use it in GitHub Desktop.
Save ericpkatz/1f07974e76acd4b9ae96 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/qomico
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
console.clear();
function sayHi(){
//console.log(this);
}
var foo = {
bar: "hello world",
sayHi: function(){
console.log(this.bar);
}
}
foo.sayHi();
foo.sayHi.call({ bar: 'goodbye'});
foo.sayHi.call({});
foo.sayHi();
</script>
<script id="jsbin-source-javascript" type="text/javascript">console.clear();
function sayHi(){
//console.log(this);
}
var foo = {
bar: "hello world",
sayHi: function(){
console.log(this.bar);
}
}
foo.sayHi();
foo.sayHi.call({ bar: 'goodbye'});
foo.sayHi.call({});
foo.sayHi();
</script></body>
</html>
console.clear();
function sayHi(){
//console.log(this);
}
var foo = {
bar: "hello world",
sayHi: function(){
console.log(this.bar);
}
}
foo.sayHi();
foo.sayHi.call({ bar: 'goodbye'});
foo.sayHi.call({});
foo.sayHi();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment