JavaScript code using an array concept
JavaScript code using an array concept
. <html>
<body>
<script>
// A new array:
var Primes = [2,3,5,7,11,13,17,19,23] ;
document.writeln(Primes) ;
document.writeln(Primes[0]) ;
document.writeln(Primes[1]) ;
document.writeln(Primes[5]) ;
var Fibonacci = [] ;
Fibonacci[0] = 0 ;
Fibonacci[1] = 1 ;
Fibonacci[2] = 1 ;
Fibonacci[3] = 2 ;
Fibonacci[4] = 3 ;
Fibonacci[5] = 5 ;
Fibonacci[6] = 8 ;
document.writeln("<br />") ;
document.writeln(Fibonacci) ;
document.writeln(Fibonacci[0]) ;
document.writeln(Fibonacci[6]) ;
</script>
</body>
</html>
<body>
<script>
// A new array:
var Primes = [2,3,5,7,11,13,17,19,23] ;
document.writeln(Primes) ;
document.writeln(Primes[0]) ;
document.writeln(Primes[1]) ;
document.writeln(Primes[5]) ;
var Fibonacci = [] ;
Fibonacci[0] = 0 ;
Fibonacci[1] = 1 ;
Fibonacci[2] = 1 ;
Fibonacci[3] = 2 ;
Fibonacci[4] = 3 ;
Fibonacci[5] = 5 ;
Fibonacci[6] = 8 ;
document.writeln("<br />") ;
document.writeln(Fibonacci) ;
document.writeln(Fibonacci[0]) ;
document.writeln(Fibonacci[6]) ;
</script>
</body>
</html>
Comments
Post a Comment