Why do JSON, Date, and Math exist?

Brendan Eich brendan at mozilla.org
Fri Feb 17 15:39:32 PST 2012


JS1 in 1995 needed *some* batteries included: Date, Math functions. I 
chose java.util.Date (implementation, this was the one piece I had help 
on from Ken Smith of Netscape, was a port from Java to C) and 
java.lang.Math.

JSON is more recent but again we want some batteries included, 
especially for the browser JS embedding. Downloading requires 
provisioning and hurts page load performance (pay for what you use but 
it's still a big-enough cost). JSON is based on Doug Crockford's 
json2.js which people were in fact downloading.

You could argue JSON didn't need to be in the core language. We did it, 
it's not worth revisiting. But the ES6 module system should help us 
avoid yet more such global namespace-object additions.

/be



Corey Richardson wrote:
> They seem rather out-of-place in a language that includes no standard library.
> I would include RegExp in that list but there is literal syntax for that in
> the language.
>
> Are the reasons purely historical/for convenience of standardization in
> JavaScript? They seem like something the host environment should provide,
> not a native object.
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>


More information about the es-discuss mailing list