Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
101
rated 0 times [  106] [ 5]  / answers: 1 / hits: 58226  / 12 Years ago, thu, may 10, 2012, 12:00:00

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]

More From » jquery

 Answers
140

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.


[#85659] Wednesday, May 9, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
stephonkeandrer

Total Points: 392
Total Questions: 94
Total Answers: 100

Location: Tajikistan
Member since Sun, Aug 29, 2021
3 Years ago
;