<html> <head> <script language="javascript" type="text/javascript"> function removeDuplicatedNumbersInArray(sequence) { var filteredSequence = []; /* Remove potential duplicate element values from array and retain original ordering */ for (var o = 0; o < sequence.length; o++) { if (filteredSequence.length == 0) { filteredSequence.push(sequence[o]); } else { var foundDuplicate = false; for (var f = 0; f < filteredSequence.length; f++) { if (sequence[o] == filteredSequence[f]) { foundDuplicate = true; } } if (foundDuplicate == false) { filteredSequence.push(sequence[o]); } } } return(filteredSequence); } </script> </head> <body onload='javascript:document.getElementById("output").value = removeDuplicatedNumbersInArray([6,2,2,2,4,2,5,1,1]);'> Given the array sequence: [6,2,2,2,4,2,5,1,1] remove the duplicated numbers without sorting.<br /> <span style="font-size:9pt">For reference, the number sequence returned should be: [6,2,4,5,1]</span> <br /><br /> <strong>Function Logic Output:</strong><br /> <textarea name="output" id="output" rows="4" cols="30"></textarea> </body> </html>