Skip to content

Instantly share code, notes, and snippets.

@robotlolita
Created April 17, 2011 01:22
Show Gist options
  • Save robotlolita/923661 to your computer and use it in GitHub Desktop.
Save robotlolita/923661 to your computer and use it in GitHub Desktop.
function SomeObject() {
this.x = 0;
}
SomeObject.prototype = (function() {
return { foo: foo
, bar: bar }
function foo() { return bar() } /* function definition */
function bar() { return foo() }
var x = function() { } /* function expression - never executes */
})()
------------------------------------------------
The order it is represented in the syntax tree:
function SomeObject() {
this.x = 0;
}
SomeObject.prototype = (function() {
var x
function foo() { return bar() }
function bar() { return foo() }
return { foo: foo, bar: bar }
x = function() { }
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment