I’m just trying to split an object using commas as a delmiter. I know there is SOMETHING to split because when I output it by itself… it successfully says (over a loop) 1,1 and other numbers.
Here is a JSFiddle. http://jsfiddle.net/weka/5Xtwj/
If you remove these last two lines in the JavaScript section, it will work correctly because I am not wanting to get the X of the array.
var getX = path[index].split(",");
$("#debug").append("X: " + getX[0]);
PS – It is using this pathfinding script as an external library. But that isn’t the problem.
You can use split with only strings, as you can see on your console.log it’s an array of arrays, so that’s why you’re getting this error.
You can get the X value with the following codes:
Using slice:
Or: