CyanSalt / notebook

3 stars 0 forks source link

Babel 未能符合 ECMAScript 规范的表现 #15

Open CyanSalt opened 5 years ago

CyanSalt commented 5 years ago

path: non-compliant-babel


1. Symbol 类的实例与 typeof

const s = Symbol()
console.log(s === Object(s), typeof Object(s))

执行结果:

// Node 10.13
false "object"

// Node 0.10 + babel-runtime@6.26.0
true "symbol"

补充:这一差距是无法实现的,参见 http://www.ecma-international.org/ecma-262/#sec-object-constructor ,Object 转换的过程没有调用非内部方法