Symbol.isConcatSpreadable JavaScript

The JavaScript Symbol.isConcatSpreadable property determines if an object should be flattened to its array elements or not. Syntax: Array_name[symbol.isConcatSpredable] = true/false Returns: Symbol corresponding to a specific key. Example 1: <!DOCTYPE html> <html> <body> <script> var alpha = [‘X’, ‘Y’, ‘Z’]; var beta = [‘A’, ‘B’, ‘C’]; beta[Symbol.isConcatSpreadable] = true; var Display = alpha.concat(beta); document.write(Display); … Read more

Symbol.hasInstance JavaScript

The JavaScript Symbol.hasInstance property finds out that a constructor object recognizes an object as its instance or not. Syntax: [Symbol.hasInstance] (object) Parameters: object: It represents the specific object to be checked as a symbol instance. Returns: It returns true if the object is an instance of a symbol, otherwise returns false. Example 1: <!DOCTYPE html> … Read more

JavaScript Symbol.toString() method

The JavaScript Symbol.toString() method retrieves a string representation of an object. Syntax: Symbol.toString(); Returns: String representation of a symbol object. Example: <!DOCTYPE html> <html> <body> <script> var alpha = Symbol.for(“a”); document.write(alpha.toString(alpha)); </script> </body> </html>

JavaScript Symbol.keyFor() method

The JavaScript Symbol.keyFor() method is used to search for the key of a global symbol. It returns undefined if the symbol is not found. Syntax: Symbol.keyFor(symbol); Parameters: symbol: It represents the specific symbol for which the key has to be fine. Returns: Key corresponding to a specific symbol. Example 1: <!DOCTYPE html> <html> <body> <script> … Read more

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>