Business

header ads

JavaScript : Array JavaScript

In this article , Array is collection of elements or items





Array javascript: Array Literal



Example:



<script>
var animals=["lion","tiger","car"];
for (i=0;i< animals.length;i++){
document.write(animals [i] + "<br/>");
}
</script> 





Array is JavaScript Keyword:Javascript Array

Create array using the keyword

Var animals= new Array();
animals [0] = "Lion";
animals [1] = "Tiger";
animals [2] = "Cat";

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



We have lot of array method in Javascript



Post a Comment

1 Comments

  1. Need more detail from the blog like push and pop in array

    ReplyDelete