toString()与String()的区别说明
数值,布尔值,对象和字符串都有一个toString()方法(该方法返回字符串的一个副本)。但Null和undefined值没有这个方法
在不知道要转换的值是不是Null还是undefined的情况下,还可以使用转型函数String(),这个函数能将任何类型的值转换为字符串。
null.toString() //"Uncaught TypeError: Cannot read property 'toString' of null"
String(null) // 'null'