I have some unexpected results with arrays, what is the reason?

I am trying to seperate int and string values from array. What is these commas in output?

1 Like

Those are the specific indexes where you had a letter (in the number array), or a number (in the letter array).

This is a possible workaround:

for(var i = 0; i<=x.length-1; i++){
   if(typeof x[i] == "number"){
         xInt[xInt.length] = x[i];
     }
   else{
         xStr[???] = x[i]
       }
}

I left one out so you can do and think it yourself.

i fixed the code, thank you.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.