JAVA-SCRIPT ARRAY

(3)simple array example:

<script>
               
                var emp=["Sonoo","Vimal","Ratan"];

document.write(emp[0]+"<br>");
document.write(emp[1]+"<br>");
document.write(emp[2]);

</script>   
          
(4)New keyword using array example:

<script> 
                var  i; 
                var emp = new Array(); 
                emp[0] = "Arun"; 
                emp[1] = "Varun"; 
                emp[2] = "John"; 
                document.write(emp[0]+"<br>");
                document.write(emp[1]+"<br>");
                document.write(emp[2]+"<br>");
</script> 


(5)array  constructor :

<script> 
                var  emp=new Array("Jai","Vijay","Smith"); 
               
                document.write(emp[0] + "<br>"); 
                document.write(emp[1] + "<br>");
                document.write(emp[2] + "<br>");
                 
                </script> 
Previous
Next Post »