For instance:

if(gl && gl.goals.count() > 0) {
return gl;
} else {
return null;
}

Will fail if gl === null, because gl.goals.count() is an async call, it will be lifted above the if statement and therefore executed first.

Submitted by Zef Hemel on 3 March 2011 at 14:17

Log in to post comments