In Association with Amazon.in   Flipkart

Tuesday, September 10, 2013

JavaScript Numeric Array With Example

JavaScript Numeric Array: An array with index/keys as sequence numbers.

Syntax1: 
 a = new Array(123, "hello", 78.96);


Syntax2: 
 a = new Array();
a[0]=123;
a[1]="hello";
a[2]=78.96;

document.write(a); // 123, hello, 78.96
  
To find Array Length:  

document.write(a.length); // 3

To print all Array elements:

for(i=0; i<a.length; i++)
{
  document.write("<br/>" + a[i] );


output:-
123
hello
78.96
 

No comments:

Post a Comment


Related Posts Plugin for WordPress, Blogger...