Darien Valentine (2018-08-05T03:04:38.000Z)
valentinium at gmail.com (2018-08-05T03:05:41.481Z)
> Per spec, the three expressions should produce "0", as the three objects have a [[NumberData]] internal slot (step 4 of [1]). I guess there is some discrepancy between implementation and spec for those exotic edge cases? There’s no discrepancy — they shouldn’t all produce "0", because the algorithm calls ToNumber on the value if it has the [[NumberData]] slot. This in turn calls ToPrimitive because the value is an object. This ultimately ends up calling the `@@toPrimitive` or `toValue` method _of_ the object. In the case of the object with String.prototype for its prototype, this will be `String.prototype.toValue`, which throws if its receiver doesn’t have [[StringData]]. In the case of the object with Object.prototype for its prototype, this will be `Object.prototype.toValue`.