Thread: Help Array!!!!!
View Single Post
Old 12-30-2012, 01:00 PM   PM User | #11
triko
New Coder

 
Join Date: Oct 2012
Location: Italy
Posts: 72
Thanks: 3
Thanked 0 Times in 0 Posts
triko is an unknown quantity at this point
Quote:
Originally Posted by jmrker View Post
When you make an assignment to the evenOdd variable,
you are using an element position in an empty array1 ... hence the NaN error.

What is it that you are really trying to accomplish?
Yes You have reason... no sense, i'm wake up this morning and my brain asked me the answer This is the final problem
Code:
function exchangeSymmetric ()
{
    var arrayPrincipal = [4, 2, 13, 0, 5];
    var arrayEven = [];
    var arrayOdd = [];
    for (i = 0; i < arrayPrincipal.length; i++)
    {
        var evenOdd = arrayPrincipal [i];
        var remainder = evenOdd%2;
        if (remainder == 0)
            arrayEven [i] = arrayPrincipal [i];
        else
            arrayOdd [i] = arrayPrincipal [i];
    }
    alert ("This is Array Even" + " " + arrayEven);
    alert ("This is Array Odd" + " " + arrayOdd);
}
This is work!
Only one problem, between the number that is the " comma " " , " !!! Don t know how to remove!!!!
triko is offline   Reply With Quote