There are 2 types of String methods.
- Normal string methods – e.g. replace, search, match methods
- HTML helper methods – e.g. anchor(), bold(), fontcolor(), italics(), link(), small()
Examples on normal string methods
Converting the string to upper case or lower case
You can convert the string to lower case using “toLowerCase” method.
console.log (“Lower case city is ” + city.toLowerCase());
You can convert the string to upper case using “toUpperCase” method.
console.log (“Upper case city is ” + city.toUpperCase());
Finding the length of the string
You can find the length of string using “length” property.
console.log (“Length of city is ” + city.length);
Below image shows all normal methods in action.
Examples on HTML string methods
Below image shows all HTML helper methods in action.