Created
January 13, 2017 19:08
-
-
Save optimistanoop/686661cb7e2ce108d742e19dbd3d04a8 to your computer and use it in GitHub Desktop.
Example of this in Js
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 fn = function (a,b){ | |
console.log(this , a , b); | |
} | |
var red = { method : fn }; | |
red.method(1,2); // { method : fn }, 1,2 | |
fn(1,2) // window, 1,2 | |
fn.call(red, 1,2) // { method : fn }, 1,2 | |
var yellow = "yellow"; | |
red.method.call(yellow, 1,2); // yellow, 1,2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment