Skip to content

Instantly share code, notes, and snippets.

@m4tthumphrey
Last active December 14, 2015 16:38
Show Gist options
  • Save m4tthumphrey/5115996 to your computer and use it in GitHub Desktop.
Save m4tthumphrey/5115996 to your computer and use it in GitHub Desktop.
var a = [];
function addPart(part) {
someFunction('blah', function(var) {
alert(a.length); // correct value: 0, 1, 2
a.push(part);
});
}
function init()
{
addPart('one');
addPart('two');
addPart('three');
}
init();
alert(a.length); // empty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment