Last active
December 18, 2015 16:58
-
-
Save neektza/5815108 to your computer and use it in GitHub Desktop.
"Functional JavaScript" erratum
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
// Section: "Prototype-based OO programming", 2nd example | |
var bFunc = function() { return this } | |
var b = { name: "b", fun: bFunc } | |
b.fun() | |
// => Object {name: "b", fun: function} |
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 obj = { name: "I'm an object", myself: function() { return this } } | |
obj.myself() | |
// => Object {name: "I'm an object", myself: function} | |
pseudoSelf = obj.myself | |
pseudoSelf() | |
// => Window {top: Window, window: Window, location: Location, external: Object, chrome: Object…} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I saw that too. Here is another example. https://gist.github.com/drewlesueur/5823356
I am really liking @fogus's book btw.