Casting type to string : Type Conversion : Number Data Type JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Number Data Type » Type Conversion »

 

Casting type to string








When casting type to string, JavaScript simply calls the toString() method.

The type cast can produce a string for a null or undefined value without error.








var s1 = String(null);    //"null"
var oNull = null;
var s2 = oNull.toString()//won't work, causes an error







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Number Data Type
» Type Conversion