Quote:
Originally Posted by triko
Yes using your first method, im solve alone but now i have an other problem 
All code is write right but, remainder is NaN and evenOdd don't have value of "i"
Code:
function exchangeSymmetric ()
{
var arrayPrincipal = [4, 2, 13, 0, 5];
var array1 = [];
var array2 = [];
for (i = 0; i < arrayPrincipal.length; i++)
{
var evenOdd = array1 [i];
var remainder = evenOdd%2;
}
alert (remainder);
}
|
Your code makes no sense to me.
You create an arrayPrinciple and use the length in a for...loop,
but you never check its contents.
When you make an assignment to the evenOdd variable,
you are using an element position in an empty array1 ... hence the NaN error.
You save the last remainder of the tests which is what becomes alerted,
but it is outside the for...loop which is why only one alert occurs.
What is it that you are really trying to accomplish?