`ToNumber` and `ToString` invoking `toString`/`valueOf` for number/string objects? (Was: Re: Re: Implementing an identical JSON.stringify)

# Isiah Meadows (6 years ago)

This makes me wonder: for objects with [[NumberData]] and [[StringData]], why do they call valueOf/toString/@@toPrimitive to coerce them instead of simply accessing the boxed data directly? It seems like a pointless waste to check.


Isiah Meadows contact at isiahmeadows.com, www.isiahmeadows.com

# Jordan Harband (6 years ago)

My assumption is legacy behavior - ie, that's what browsers did, so it had to be codified in the spec.