Search
The toString() method throws an error in the case of null and undefined.
toString()
null
undefined
Let us have a look at null and toString():
The same thing happens with undefined:
When dealing with such cases, we can use the String() method.
String()