Created
May 24, 2015 19:22
-
-
Save asith-w/f2487315e2dc7533e159 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/quhede
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
var context = { | |
type: 'grizzly', | |
says: 'grr' | |
}; | |
//var says = bear.apply(context, ['grr', 'grizzly']) | |
var says = bear.call(context, 'grr', 'grizzly'); | |
console.log(says); | |
//function expression | |
// var bear = function() { | |
// return 'The ' + arguments[0] + ' bear says: ' + arguments[1] | |
// } | |
function bear() { | |
console.log(this); | |
return 'The ' + arguments[0] + ' bear says: ' + arguments[1]; | |
} | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript"> | |
var context = { | |
type: 'grizzly', | |
says: 'grr' | |
}; | |
//var says = bear.apply(context, ['grr', 'grizzly']) | |
var says = bear.call(context, 'grr', 'grizzly'); | |
console.log(says); | |
//function expression | |
// var bear = function() { | |
// return 'The ' + arguments[0] + ' bear says: ' + arguments[1] | |
// } | |
function bear() { | |
console.log(this); | |
return 'The ' + arguments[0] + ' bear says: ' + arguments[1]; | |
}</script></body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var context = { | |
type: 'grizzly', | |
says: 'grr' | |
}; | |
//var says = bear.apply(context, ['grr', 'grizzly']) | |
var says = bear.call(context, 'grr', 'grizzly'); | |
console.log(says); | |
//function expression | |
// var bear = function() { | |
// return 'The ' + arguments[0] + ' bear says: ' + arguments[1] | |
// } | |
function bear() { | |
console.log(this); | |
return 'The ' + arguments[0] + ' bear says: ' + arguments[1]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment