with this one I need is to find the difference between the numbers in first array (numberArray ) and to create new array and store in it. after running this code I get nothing in the browser.
var numberArray = [16,14,4,5]
function calculateDifferences()
{
var secondArray = new Array(numberArray.length);
for (var c = 0; c < numberArray.length - 1 ; c = c + 1)
{
secondArray[c] = difference(numberArray[c],numberArray[c+1]);
}
{
secondArray[numberArray.length - 1] = difference(numberArray[0],numberArray[numberArray.length - 1]);
}
{
return secondArray;
}
}
document.write(secondArray + '<BR>');
var numberArray = [16,14,4,5]
function calculateDifferences()
{
var secondArray = new Array(numberArray.length);
for (var c = 0; c < numberArray.length - 1 ; c = c + 1)
{
secondArray[c] = difference(numberArray[c],numberArray[c+1]);
}
{
secondArray[numberArray.length - 1] = difference(numberArray[0],numberArray[numberArray.length - 1]);
}
{
return secondArray;
}
}
document.write(secondArray + '<BR>');