Share on Google+Share on Google+

JavaScript array join

This page discusses - JavaScript array join

JavaScript array join


In this Tutorial we want to describe you a code that help you in understanding JavaScript array insert. For doing this code we are using JavaScript language as scripting language. We create an array variable that is used to instantiate array object and this array object hold the values of various element in an array object indicated by indexes[0]-[3].The for loop execute the script and return the value of the element of the array before inserting  till the length of i is less than an array length. The document. write print the value of element of the array before inserting that an array object hold.

1)array.push( )   -  This method return you to add  element to an array and provides you the new length of an array and store in a variable current paper.

The document. write print the values of an element in a array after inserting.


  <h1>JavaScript Array insert</h1>
  <title>JavaScript Array insert</title>
  <script language="JavaScript" type="text/javascript">
  var array=new Array();

  document.write("<b>"+"Element of the array before 
  inserting are "
+"</b>""<br />");

  document.write("=================""<br />");
  for(var i=0;i<array.length;i++){
  document.write"<br />");
  currentPaper = array.push("Delhi","India");
  document.write("<b>"+"Element of the array after 
  inserting are "
+"</b>""<br />");

  document.write("=================""<br />");
  for(var i=0;i<array.length;i++){

Output of the program

Download source code


Posted on: April 17, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: JavaScript array join  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image