把值转换成字符串的四种方法

 1.toString  不适用于undefined 和 Null
  2. value + '' 
  3. String(value)
4.JSON.stringify()
 
  console.log(JSON.stringify(5)); // '5'
    console.log(JSON.stringify(NaN)); // 'Null'
    console.log(JSON.stringify(null)); // 'Null'
    console.log(JSON.stringify(undefined)); // undefined 不是字符串undefined
    console.log(JSON.stringify(false)); // 'false'
原文地址:https://www.cnblogs.com/luguankun/p/13742718.html