Google News
logo
CoffeeScript - Interview Questions
What is string object in CoffeeScript/javaScript? and Explain its methods.
The string object of javascript helps you work with the series of characters. String object provides various of methods to perform various operations in strings.
 
We can use the javascript library in CoffeeScript code. Hence we can use all the methods of string object in javascript.
 
Some of the methods of string object :
 
* charAt() : This method returns the character at the given index value of a string object.

*
charCodeAt() : This method returns the Unicode value of the character at the given index.

*
concat() : This method combines two substrings and returns a superstring.

*
indexOf() : This method returns the index of calling string having the first occurrence of a specified value, It will return -1 if not found.

*
lastIndexOf() : This method returns the index of calling string having the last occurrence of a specified value, It will return -1 if not found.

*
localeCompare() : This method returns a number representing whether a reference string comes before or after or is the same as given string in sort order.

*
match() : This method is used to match a regular expression against a string.

*
search() : This method executes a search for a match between the regular expressions in a specified string.

*
slice() : Extract the section of a string object and returns a new string object.

*
split() : Splits a string object into the array of strings by separating the string into substrings.

*
substr() : This method returns the calling string beginning at the specified location through the specified number of characters.

*
toLocaleLowerCase() : Converts the calling string into the lower case while respecting the current locale.

*
toLocaleUpperCase() : Converts calling string into the upper case while respecting the current locale.

*
toLowerCase() : Returns calling string in lower case.

*
ToUpperCase() : Returns calling string in upper case.
Advertisement