Objects that can stringify in multiple ways

URLs represent a class of objects that can be stringified in multiple
ways, each of which is useful. The JavaScript standard library deals
with this situation by making toString() take an argument, as seen
with the Number class.

Is that the precedent to follow or is having some other way of
accessing such string values reasonable too?

(I feel like I've asked this question before somewhere, but I can't find it.)


-- 
https://annevankesteren.nl/

Received on Wednesday, 15 March 2017 10:25:38 UTC