pop in javascript remove last value from array

     The pop() method removes the last element from an array and returns that element.

     pop() is intentionally generic; this method can be called or applied to objects resembling arrays. Objects which do not contain a length property reflecting the last in a series of consecutive, zero-based numerical properties may not behave in any meaningful manner.

If you call pop() on an empty array, it returns undefined.

Syntax

     Array.pop();

Example

     var ar=["1st","2nd","3rd","4th"];
     ar.pop()


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?

if statement

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