MDN声明:
原始值,原始值
不是对象且没有任何方法的数据。JavaScript 有 5 种原始数据类型:字符串、数字、布尔值、空值、未定义。除了 null 和 undefined 之外,所有原始值都具有环绕原始值的对象等效项,例如 String 对象环绕字符串原始值。所有原语都是不可变的。
那么当我们调用 a "s".replace
or 时"s".anything
,它等价于new String("s").replace
andnew String("s").anything
吗?