Insert value into array

     We can insert the value into array using following methods.

Syntax

   array.push(value);

   array.unshift(value);

   array[index]=value;
Example

     var ar=[1,2,3];

     ar.push(10);

     ar.unshift(8);

     ar[3]=100;


Example Program:- (Editor)


Editor is Loading...

Advertisement

0 nhận xét:

Đăng nhận xét