Learn to use various properties and methods of String Object.
To describe the attributes of the string object a number of properties are available.
length : To find the length of the characters in the string.
constructor : To get the function which created the String Object.
prototype : To extend the string function by attaching more properties and methods to it.
There is always a need to generate a random number to display some random image, message, ads etc in an unbaised way, for that very purpose we use Math.random() method.
The method Math.random() generates a random fraction number between 0 to 1, hence to have integer you should multiply it with integers and then truncate numbers after decimal point using Math.floor() method.
The String object provides methods that can be used to create effects which are usually achieved using HTML elements,like fontsize, fontcolor, fontweight.
The String object provides methods to search for strings and then replace them with another.
The String object provides methods to perform case coversion.
The methods used for that purpose are toLowerCase() , toLocaleLowerCase() , toUpperCase() and toLocaleUpperCase()
Locale methods are used to convert based on particular locale, which are identical to generics in many except a few languages like Turkish
The String object provides methods to carry out pattern matches within a string, the most common one being match().
The String object provides an number of methods for string manipulation.
The String object methods of localeCompare() is used to compare one string to another and return values based on that.
A negative number is returned if the string should come alphabetically before the string.
A zero is returned if the string is equal to the string argument.
A positive number is returned when string should come alphabetically after the string argument.