Skip to content

Instantly share code, notes, and snippets.

@nakosung
Created September 5, 2013 09:50
Show Gist options
  • Save nakosung/6448113 to your computer and use it in GitHub Desktop.
Save nakosung/6448113 to your computer and use it in GitHub Desktop.
scope inheritance
gen_scope = (parentScope) ->
Scope = ->
Scope.prototype = parentScope
new Scope()
a = gen_scope()
a.x = 1
b = gen_scope a
b.y = 2
c = gen_scope b
c.z = 3
console.log c.x, c.y, c.z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment