typeof 'abc'
"string"
typeof new String('abc')
"object"
typeof new String('abc').valueOf()
"string"
为原始值添加方法
String.prototype.sd=function(){
console.log('I am happy')
}
var x=new String('abc');
x.sd()
VM12261:2 I am happy
typeof 'abc'
"string"
typeof new String('abc')
"object"
typeof new String('abc').valueOf()
"string"
String.prototype.sd=function(){
console.log('I am happy')
}
var x=new String('abc');
x.sd()
VM12261:2 I am happy