Javascript Methods

Some of String method :-

Search :-

The simplest regular expression related string method is search(),which takes the regular expression as an index and return the first matching character.

Example  :-

Alert(“javascript is used for validation on client side”.search(/used.*/i));

It will show the position of character matching, 15position.


Replace : replace () method returns the string that results when you replace text matching the method’s first argument with the text of the second argument.

Var s=”Hello. Javascript”;

S=s.replace(/\./,”? “);


Result :-  Hello ? Javascript.

Follow Us

Contact Us

Back to Top