> Le 5 août 2018 à 00:16, Michael Theriot <[email protected]> a 
> écrit :
> 
> `JSON.stringify` has unintuitive behavior regarding interal slots.

I don’t think that anything involving an object that has a [[StringData]] 
internal slot but has `Number.prototype` in its prototype chain could have an 
”intuitive” behaviour...

> 
> 
> I think this is related to `Array.isArray`. Is there an equivalent 
> `Number.isNumber`? Or is this just something only `JSON.stringify` can do?

Try `Number.prototype.valueOf.call(obj)`: it will throw a TypeError if and only 
if `obj` has no [[NumberData]] internal slot. Ditto for String, Boolean and 
Symbol.

—Claude
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to