Here “Symbol” is the symbol which is to be searched into the runtime-wide symbol registry.
Parameters: This function accepts a parameter “key” which is the key to the symbol and used for the description of the symbol.
Return value: This function returns the given symbol is found in the runtime-wide symbol registry otherwise a new symbol is created with the same name as the given symbol and returned.
> Symbol(Geeks) > Symbol(123) > Symbol(gfg) > Symbol(789)
> Symbol(a) > Symbol(1) > Symbol(3) > Symbol(GeeksforGeeks)
In the above code, the key should not be multiple otherwise it accepts the first element as the key and discard the remaining elements and if some arithmetic operator is used in place of the key then this function considers that key as the result of the operation.
- Google Chrome 40 and above
- Edge 12 and above
- Firefox 36 and above
- Opera 27 and above
- Safari 9 and above