

Ask HN: Why did JavaScript win the browser? - yellow_and_gray

I&#x27;m trying to understand why Javascript won the browser.<p>There were tens of other languages one could have added in a browser, and yet this particular one, which wasn&#x27;t even an established language but a new one, ended up being implemented in browsers.<p>How did that happen? If you were implementing Netscape or IE back then, what was going through your mind when you sat down implementing version one?
======
malisper
According to Wikipedia[0], Brendan Eich was originally supposed to put Scheme
in the Netscape web browser. Instead he decided to create Javascript and used
that instead.

[0]
[http://en.wikipedia.org/wiki/Brendan_Eich#Netscape_and_JavaS...](http://en.wikipedia.org/wiki/Brendan_Eich#Netscape_and_JavaScript)

~~~
uhsnamih
What prevents adding other languages to the web browser even now?

~~~
icebraining
Getting people to agree on which should be added. Adding new languages is only
useful if they're widely supported by browsers.

Google is trying with Dart, they already have a fork of Chromium with a VM for
it[1], but it still needs to be compiled to JS to support other browsers, and
to many developers that loses its appeal.

[1]
[https://www.dartlang.org/tools/dartium/](https://www.dartlang.org/tools/dartium/)

~~~
BrendanEich
And they need a way to avoid cyclic leaks among Dart and JS via the DOM. That
adds a tax in the form of write barrier overhead, which caused Apple to reject
the WebKit patch.

[https://lists.webkit.org/pipermail/webkit-
dev/2011-December/...](https://lists.webkit.org/pipermail/webkit-
dev/2011-December/018811.html)

~~~
curtis17
The most interesting way forward re languages/runtimes looks like something
Brendan mentioned here: [http://javascriptjabber.com/124-jsj-the-origin-of-
javascript...](http://javascriptjabber.com/124-jsj-the-origin-of-javascript-
with-brendan-eich/)

> At some point, Sweet.js ties the knot and people can write hygienic macros
> and extend the language.... And it’s all based on a common set of primitives
> and that’s the important thing. You can reason about the primitives. You can
> compose them. They’re compositional. They compose orthogonally. That’s the
> goal here. JavaScript has a lot of warts in it, but if you weed those out or
> deprecate them you end up with stuff that is compositional. And that’s where
> I think we’re heading.

~~~
curtis17
Scala moving in a similar direction.

Odersky: That's going to be a more fundamental rethink of what Scala is. The
main goal is to make it simpler, to review it or work out what its core is,
and have a very simple core on which essentially the other features of Scala
can all be based. Essentially, it's a way to modularize the language better,
to base the features that we know from Scala on a very, very simple core that
we can compile efficiently and reason precisely about. That's the main goals
for Don Giovanni.

[http://www.infoworld.com/t/java-programming/scala-founder-
la...](http://www.infoworld.com/t/java-programming/scala-founder-language-due-
fundamental-rethink-249845?page=0,1)

------
BrendanEich
I've written and spoken a lot about the early days. Just one example:

[http://chimera.labs.oreilly.com/books/1234000001808/pr02.htm...](http://chimera.labs.oreilly.com/books/1234000001808/pr02.html)

See also my blog and quora.com. And HN:

[https://news.ycombinator.com/item?id=1905155](https://news.ycombinator.com/item?id=1905155)

~~~
kadumel
Brendan I respect all of your work on creating a framework that gives at least
thousands of people a job every day but I don't quite understand this article
and it's purpose. I agree that you were under duress when creating but what
are we getting at here?

~~~
BrendanEich
The question was how JS "won" the browser. The answer is that Netscape (with
Bill Joy at Sun) fixed the race and ran it in 10 days. Way too little time to
use an existing language and bend it to "look like Java".

Did you read the last link, the HN comment?

Update: [http://javascriptjabber.com/124-jsj-the-origin-of-
javascript...](http://javascriptjabber.com/124-jsj-the-origin-of-javascript-
with-brendan-eich/) has more detail.

The point of all this isn't subtle. MS was coming after Netscape, copying and
injecting stuff like VBScript. JS was a rush job because of this. If it had
waited till Netscape 3 the odds of a VBScript mandatory single scripting
language for the Web would've been high. Netscape 4 was way too late.

Only by going out in Netscape 2 did JS preempt that VBScript dystopia. Only by
looking like Java did it get management support. Only by being its own
language did it happen in ten days.

/be

~~~
miketaylr
Have a quick view-source at
[http://portal.mj.gov.br/EstrangeiroWEB/destaques.asp](http://portal.mj.gov.br/EstrangeiroWEB/destaques.asp)
for those who can't imagine what VBScript dystopia looks like.

~~~
danielfilho
where else you'd find such a pearl?

brazilian government FML! I mean, FTW!

------
timetraveller
Firstly, JavaScript was specifically created (tailored) for browsers.

Secondly, despite all the negative rants and how awful it is, JavaScript is
very flexible and forgiving which is a good thing for web pages. Imagine if
you get a parser error message preventing you from viewing every page that has
a little error/bug/incompatible code with your JS version, etc.

~~~
wtbob
I think that if one _did_ get such messages then it'd be better, since folks
would have an incentive to fix their pages, of not rely on JavaScript (which
would be even better … I'm tired of blood which won't display text without me
having to grant them acres to run coffee on my system.

~~~
davidddavidson
"I'm tired of blood which won't display text without me having to grant them
acres to run coffee on my system."

What? Many autocorrect fails right here...

~~~
wtbob
Argh. Blogs/access/code

I blame swipe typing.

------
JaviScript
JavaScript was the first programing language that runs in a browser.
Historically this was the main reason, JS was developed for the most used
browser in 1995: Netscape. Also this implementation become an standard:
ECMAScript. Be the first, the most used and became a well-defined standard are
requisites to success.

Microsoft tried to do their own language for browsers called JScript (based in
JavaScript but really incompatible with the ECMAScript specification). JScript
was important but the people preferred the compatibility between browsers and
not the features on JScript, so they supported more the JavaScript
implementation.

With this scenario, JavaScript become the unique supported programing language
in the browsers. Other companies tried to create the next generation of
browser-languages like Google with Dart but JavaScript is so expanded that
it's practically impossible to be substituted in short-term.

~~~
nhebb
Microsoft also pushed VBScript in the browser. They've finally dropped support
for it in IE 11: [http://msdn.microsoft.com/en-
us/library/ie/dn384057%28v=vs.8...](http://msdn.microsoft.com/en-
us/library/ie/dn384057%28v=vs.85%29.aspx)

------
TheLem
I think the best answer to your question is this video :

[https://www.destroyallsoftware.com/talks/the-birth-and-
death...](https://www.destroyallsoftware.com/talks/the-birth-and-death-of-
javascript)

Title : THE BIRTH & DEATH OF JAVASCRIPT By : Gary Bernhardt From : PyCon 2014

