Again, you don't need to use this here: for (value = 0; value < (returnArray.length-1); value++); as length was already declared and assigned (arrayToSort.length) eariler.
If it makes you feel any...
Type: Posts; User: nomisco
Again, you don't need to use this here: for (value = 0; value < (returnArray.length-1); value++); as length was already declared and assigned (arrayToSort.length) eariler.
If it makes you feel any...
for (counter = 0; counter < length; counter + 1)
counter = counter + 1
OK.
Your final output will be document.write('Unsorted array ' + unsortedArray);
Then you want to output the sorted array, so the next line will be document.write('Sorted array ' +...
Well, bubbleSort(arrayToSort) is the argument for the bubbleSort function. So, you need bubbleSort(name of the array you are sorting).
Hint: it's declared outside of the that function.
OK, check these things - I won't directly give you the answer :rolleyes:
1. Near the bottom you have 'length = unsortedArray' why?
2. The line document.write('Sorted Array: ' + returnArray); is...
For starters, although not an error, the length of the array (arrayToSort.length) has already been assigned to the variable 'length'.
So, you should replace 'for (counter = 0; counter <...
I guess you're doing M150 as well?