convert string array to integer array

javascript, jquery

Solution

Strings in the console are symbolized by wrapping them in quotes. By that fact, we can assume that `i` is a string. Convert it to an integer and it will no longer be a string and no longer have those quotes.

endFlowArray.push(+i);

Your "numbers" in `flowEnd` and `dateFlow` are actually strings, not numbers.

Problem

I have created an array: ``` var endFlowArray = new Array; for (var endIndex in flowEnd) { // <- this is just some numbers for (var i in dateflow) { // <- same thing var check = $.inArray(flowEnd[endIndex], dateflow[i]); if (check >= 0) { endFlowArray.push(i); flowEnd[endIndex] = null; } } } ``` How can I convert a string array of: ``` ["286", "712", "1058"] ``` to integer array like: ``` [286, 712, 1058] ```

Original source