JavaScript Symbol.for() method

The JavaScript Symbol.for() method is used to find out the existing symbol in a runtime-wide symbol registry with the provided key. It will create a new symbol if it does not exist for the specified key. Syntax: Symbol.for(key); Parameters: key: It represents the specific key for which the symbol has to be fine. Returns: Symbol … Read more

Symbol function JavaScript

JavaScript Symbol function is used to identify the properties of an object. Note: It always returns a unique value. A symbol value may be used as an identifier for object properties. Like numbers or strings, Symbols are also immutable. Syntax: Symbol([description]) Parameters: description: It represents the symbol description. JavaScript Symbol Methods for() Method: Use: To … Read more

toLocaleUpperCase() String JavaScript JS

The JavaScript string toLocaleUpperCase() method transforms the given string into an uppercase letter on the basis of the current locale of the host. Note: A string can be converted into upper case letters with the toUpperCase() method but the result may vary according to locale or language. To overcome this problem we have to use … Read more

JavaScript String toUpperCase() method

The JavaScript string toUpperCase() method transforms the given string into the uppercase letter. Syntax: string.toUpperCase() Return: String with upper case letters. Example: <!DOCTYPE html> <html> <body> <script> var a =”Hello World!”; document.write(a.toUpperCase()); </script> </body> </html>

JavaScript String toLocaleLowerCase() method

The JavaScript string toLocaleLowerCase() method transforms the given string into a lowercase letter on the basis of the current locale of the host. Note: A string can be converted into lowercase letters with the toLowerCase() method but the result may vary according to locale or language. To overcome this problem we have to use toLocaleLowerCase(). … Read more

JavaScript String toLowerCase() method

The JavaScript string toLowerCase() method transforms the whole string into lowercase letter. Original string will not be modified. Syntax: string.toLowerCase() Return: String with lowercase letters. Example: <!DOCTYPE html> <html> <body> <script> var a =”HELLO WORLD!”; document.write(a.toLowerCase()); </script> </body> </html>

JavaScript String slice() method

The JavaScript string slice() method retrieves a part of the given string on the basis of the specified index. It is similar to substring, the only difference is that it supports the negative index. In the case of the negative index, it starts retrieving the sub-string from the end of the string. Syntax: string.slice(start_index, end_index) … Read more

JavaScript String substring() method

The JavaScript string substring() method retrieves the part of the given string on the basis of the specified index. The original string will not be modified. It is similar to slice, the only difference is that it does not support the negative index. Note: It returns the complete string if we do not pass any … Read more