im having trouble returning an array that contains decimal values to a variable:
function foo() {
var coords = new Array(39.3,18.2);
console.log(coords[1]); //successfully logs 18.2
return coords;
}
but then...
var result = foo();
alert(result[0]);
that last one throws this error: Uncaught TypeError: Cannot read property '0' of undefined
alert(result[0])
? Everything else looks fine - I'd say the problem is somewhere else in your code. – Matt Sep 20 '11 at 18:24