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

Nhận xét

Bài đăng phổ biến từ blog này

How to set the SDK, NDK and JDK path to android studio?

physicsjs - Increase the restitution value for circle and retangle

Select all values from list box in a single click using javascript