Hello guys.
I need to know how can i write a script to read 20 numbers within 10 - 100 range and print it only if it is not an duplicate of a number that has already been read. I need to do this with only using a single one dimensional array .currently my script is as follows
The problem with this script is the flag variable dose not hold the all previous values. anyway to do this using a single one dimensional array?
I need to know how can i write a script to read 20 numbers within 10 - 100 range and print it only if it is not an duplicate of a number that has already been read. I need to do this with only using a single one dimensional array .currently my script is as follows
Code:
<script type="text/javascript"> //creating an array which hold the 20 numbers myArray = ["22","32","43","54","65","76","87","98","19","25","11","12","13","14","15","16","17","18","19","22"]; var flag = 0; for (var i = 0; i < myArray.length; i++) { if (flag != myArray[i]) { document.write(myArray[i] + " "); flag = myArray[i]; } } </script>

Comment