Introduction to JS
Introduction Of Javascript
It is the type of an object in which we can store sequence of characters. We have some ways to create the string which are described as follows:-:-
By string literal
Syntax
var nameofString = "value of string" ;
Let's take an example:-
This is one way how we create string.
Through string object by using the new keyword
We use the new keyword to create an array here
Syntax
var nameofString = new String("string literal");
Let's take an example:-
This is other way how we create the string directly by using the new keyword.
Some more methods and description below :-
Methods | Description |
---|---|
concat() | Combination of two or more string |
charAt() | provides the char value present at the specified index. |
indexOf() | provides the position of a char value present in the given string. |
lastIndexOf() | provides the position of a char value present in the given string by searching a character from the last position. |
search() | It searches a specified regular expression in a given string and returns its position if a match occurs. |
match() | It searches a specified regular expression in a given string and returns that regular expression if a match occurs. |
replace() | It replaces a given string with the specified replacement. |
substring() | It is used to fetch the part of the given string on the basis of the specified index. |
toLowerCase() | It converts the given string into lowercase letter. |
toUpperCase() | It converts the given string into uppercase letter. |
toString() | It provides a string representing the particular object. |
valueOf() | It provides the primitive value of string object. |
JS training insitute | Best IT Training classes in Gurgaon | Web Designing Training Institute