Minggu, 27 Januari 2019

Slice() Array Inward Javascript

     Return the selected value from array, nosotros tin displace conduct the array value past times using index. If the specified index value is out of hit as well as then it volition provide the -1.
slice() method for string values


Syntax
      string.slice(startindex[,endindex]);

 endindex is the optional.

Example :
 var fruits = ["Jan", "Feb", "Mar", "Apr", "May"];
alert(fruits.slice(1)); //return two to fifth value  (Not removed)

alert(fruits.slice(2,4));  //return three to quaternary value

Example Program:- (Editor)


Editor is Loading...

Advertisement

Tidak ada komentar:

Posting Komentar