const yy = 'yuusa'
const y1 = new String(yy)
const y2 = String(yy)
console.log(yy, y1, y2)
console.log(yy === y1)
console.log(yy === y2)
console.log('type')
console.log(typeof yy)
console.log(typeof y1)
console.log(typeof y2)
// 输出对象值
console.log(y1+'')
console.log(String(y1))
console.log(y1.toString())
// 检测类型
const checkType = Object.prototype.toString
console.log(checkType.call(yy))
console.log(checkType.call(y1))
console.log(checkType.call(y2))
在node中输出
const obj = new String(‘hello word’)
在浏览器中输出