Skip to content

Instantly share code, notes, and snippets.

@neektza
Last active December 18, 2015 16:58
Show Gist options
  • Save neektza/5815108 to your computer and use it in GitHub Desktop.
Save neektza/5815108 to your computer and use it in GitHub Desktop.
"Functional JavaScript" erratum
// 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}
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…}
@drewlesueur
Copy link

I saw that too. Here is another example. https://gist.github.com/drewlesueur/5823356

I am really liking @fogus's book btw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment