Hi,

Through a asynchronous request a fill up a stack (2-dimentional) but now I can't 'pop' something off. It keeps giving a 'undefined';

The stack looks like this:
Code:
var stack = new Array();

function fillstack(){
stack[startStop + '_' + hash] = new Array;
stack[startStop + '_' + hash]['set'] = '';
stack[startStop + '_' + hash]['hash'] = '';
stack[startStop + '_' + hash]['latlng'] = '';
stack[startStop + '_' + hash]['startStop'] = '';

// offcourse there is more logic to fill those fields, but a console.log reveals a full stack
// when it's done, it calls the popfromstack()
}
In a other function I want check if somthing is in the stack, and if so pop something of and then process it (they are start and stop adresses and need to be geocoded, so I need to space out the request to prevent floading)

Code:
function popfromstack() {
	console.log(stack); 

        dataitem = stack.pop();
	console.log(dataitem);

	if (dataitem['set'] == 'empty'){
		$('#' + dataitem['startStop'] + '_' + dataitem['hash']).html('no data');
	}
...
The console.log(stack) returns the filled stack. but dataitem keeps being undefined. What am I doing wrong?