Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Why did JavaScript win the browser?
5 points by yellow_and_gray on Aug 30, 2014 | hide | past | favorite | 23 comments
I'm trying to understand why Javascript won the browser.

There were tens of other languages one could have added in a browser, and yet this particular one, which wasn't even an established language but a new one, ended up being implemented in browsers.

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?




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...


Thanks for this link. It points to http://www.computer.org/csdl/mags/co/2012/02/mco2012020007.p...

"When Netscape hired Brendan Eich in April 1995, he was told that he had 10 days to create and produce a working prototype of a programming language that would run in Netscape’s browser. Back then, the pace of Web innovation was furious, with Microsoft suddenly making the Internet the focus"

and

"[it] needed to be a silly little brother language."

It seems it was important to implement the language quickly rather than try and make it too good.


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


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/


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/...


The most interesting way forward re languages/runtimes looks like something Brendan mentioned here: http://javascriptjabber.com/124-jsj-the-origin-of-javascript...

> 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.


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...


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

http://chimera.labs.oreilly.com/books/1234000001808/pr02.htm...

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

https://news.ycombinator.com/item?id=1905155


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?


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... 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


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


where else you'd find such a pearl?

brazilian government FML! I mean, FTW!


Thank you for the links and the explanation, I appreciate it.

The lesson here is a bigger one: how new tech wins a race when it's chased by a big monster truck. Javascript got out there fast/first, looked familiar, and sidestepped conventions.

That Javascript went to ECMA for standardization, to push back on Microsoft, was a nice touch.


What would you have changed/used if management hadn't insisted on something that "looks like Java"?

I guess one can't thank you enough for saving the web from VBScript!


Search for "HyperTalk" in the transcript below the fold at

http://javascriptjabber.com/124-jsj-the-origin-of-javascript...

and you'll see what I wanted to do absent the "make it look like Java" orders. More natural language syntax, no curly braces -- like Logo, Smalltalk, Self, HyperCard.

/be


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.


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.


"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...


Argh. Blogs/access/code

I blame swipe typing.


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.


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...


Dart has replaced Node.js for me, not JavaScript.


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

https://www.destroyallsoftware.com/talks/the-birth-and-death...

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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: