神奇的String对象
一、既可以作为基本类型,也可以作为引用类型
const str = 'Caden';
console.log(typeof str); // string
const strObj1 = new String(str);
console.log(typeof strObj1); // object
const strObj2 = String(str);
console.log(typeof strObj2); // stringconst a = "Bob";
const b = "Bob";
const c = new String("Bob");
const d = new String("Bob");
console.log(a === b); // true
console.log(b === c); // false
console.log(c === d); // false二、String的原型对象prototype,基本类型和引用类型都可以引用
三、String对象的value值
四、String对象方法
方法
描述
最后更新于