<!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title> Display Unique Numbers </title> <meta name="GENERATOR" content="Arachnophilia 4.0"> <meta name="FORMATTER" content="Arachnophilia 4.0"> <script language="JavaScript"> <!-- ; var theArray = new Array( 20 ); var dup = false; document.writeln("Exercise 12.13<P>"); // This construct does not work in Netscape or IE5: for( var i in theArray ) for( var i = 0; i < theArray.length; i++ ) { theArray[ i ] = Math.floor( 10 + Math.random() * 90 ); if( i > 0 ) { for( var j = 0; j<i && dup == false; j++ ) { if( theArray[ j ] == theArray[ i ] ) dup = true; } } if( dup == false ) document.writeln("Item " + i + " was unique when added to array: " + theArray[ i ] +"<BR>"); dup = false; } // end hide --> </script> </head> <body> <P> <a href="12_13src.html">View Source</a> </body> </html>