Thứ Tư, 24 tháng 2, 2016

slice() string in javascript

          Return the selected value from string, we can select the string value by using index. If the specified index value is outof range then it will return the -1.
slice() method for array values


Syntax

     string.slice(startindex[,endindex]);

 endindex is the optional.

Example

str="Merbin joe" ;



alert(str.slice(3));   //return from 3rd character ["bin joe"]

alert(str.slice(3,5)); //return 3 to 5th character ["bi"]

Example Program:- (Editor)


Editor is Loading...

Advertisement

0 nhận xét:

Đăng nhận xét

Popular Posts

Tìm kiếm Blog này

Được tạo bởi Blogger.

Morning Charts 07/01/2019 SPX