Check out a free preview of the full The Good Parts of JavaScript and the Web course:
The "History of JavaScript" Lesson is part of the full, The Good Parts of JavaScript and the Web course featured in this preview video. Here's what you'd learn in this lesson:

Doug spends some time talking about how JavaScript was created. He includes the companies involved in its creation as well as the history behind its naming. Doug also briefly talks about the evolution of ECMAScript and the differences between versions.

Get Unlimited Access Now

Transcript from the "History of JavaScript" Lesson

>> [MUSIC]

>> Douglas Crockford: And then there was JavaScript, so to recap, first, there was The Big Bang. Then there was The Down of Man and then there was JavaScript. So I was the first person to recognize that JavaScript had good parts, that was the first important discovery of the 21st century.

[00:00:22] And when I announced my results they were met with wild skepticism. No way, there cannot possibly be any good parts in JavaScript. But it turns out that my results were validated and in fact JavaScript has some very good parts.
>> Speaker 2: This is the most important discovery of the 21st Century.

[00:00:39] And you made this?
>> Douglas Crockford: Yeah, I did that.
>> Speaker 2: [INAUDIBLE]
>> Douglas Crockford: So I'll give you some historical background. At the National Center for Supercomputing Applications at the University of Illinois, Urbana-Champaign, there are a bunch of kids who are developing a client program for the Internet. At that time, there were a number of protocols that were being considered for the way that the Internet was going to deliver information to people.

[00:01:06] There was WAIS, Archie, Gopher, FTP, Finger and a few others and the World Wide Web. And these guys didn't know which of those was going to win. So they wrote a program that worked for all of them and they called the program mosaic. And because of the way that they implemented the viewer for the World Wide Web.

[00:01:28] The World Wide Web one and the thing that they did was they came up with something called the image tag which allowed. The web to display images, which is something that the other formats couldn't easily do. And because the web could display images, it could look like what you wanted it to be even if it wasn't what you wanted it to be, and that was efficient and that allowed the web to win and everything took off from there.

[00:01:55] A bunch of the people from that project where it lured to California, where they became part of a company called Netscape. Netscape made the first commercial web browser called Netscape Navigator, and it was a huge hit. It kinda disrupted everything, and they were then planning what to do for Navigator 2.

[00:02:18] And they added a bunch of new features including support for electronic commerce. They also wanted to make it easy for end user programming. They remembered something that had been on the Macintosh called HyperCard. HyperCard was a simple application creation program based on a simple metaphor of stacks of cards and it was an event driven script thing.

[00:02:44] And it was remarkably easy to use and they wanted something like that in the web browser. So they gave that job to this guy. This is Brendan Eich very smart guy, he'd been a kernel hacker at Silicon Graphics, his idea was he would write a Scheme interpreter to do this.

[00:03:01] And he was told no don't do Scheme, do a language that people like. Make it look like Joller, Visual Basic, something popular. This is for the kids. So he was given ten days to create a prototype of this new interactive browser and in those ten days. He designed and implemented a new programming language which is an amazing achievement.

[00:03:26] So from Java he took syntax. In fact, most of the things that are wrong with JavaScript are things that were inherited from Java. There's a language called Scheme which is a dialect of Lisp that was developed at MIT. And Scheme has lambdas, that's what Scheme calls its functions and he took Scheme functions and he put them into his language.

[00:03:52] And there's a dialect of Smalltalk called Self that was developed first at Xerox Parc and then later at Sun Labs. Self, took Smalltalk, which was the first modern classical language, object oriented language and made it better. Both better performance and more expressive user to use by removing one feature from Smalltalk.

[00:04:16] It's uncommon where someone makes a new language by removing things from another language. Usually it's adding more stuff. The thing they removed from Smalltalk was classes. By removing classes, they could make it faster, and they could make it much better to program. And so, he took out idea and put it into his language and that Cape called it LiveScript.

[00:04:40] Now, while that was going on there was another language that was being developed by a guy at Sun named James Gosling. He started with something called Green talk. He was then moved into a new company that was developing set top box applications their his language became called oak.

[00:04:56] That company failed so his brought back into Sun and they try to figure out what do we do with this language now. The Internet was becoming popular, the web becoming popular, they wrote a web browser in this language. That browser called HotJava was wildly successful at least for a short time and the language that.

[00:05:19] They wrote it in, had its name changed to Java and it became wildly successful. So much so that some were making noise that the Java language was going to be the future of software. That if you design all of your programs to target the Java virtual machine instead of the operating system we can be liberated from Microsoft.

[00:05:44] And that was a wildly successful message and Java shoots up like that. It is the most successful launch of a new programming language in history. It's amazing. At Netscape, they're making similar claims. They're saying if you design your applications to target the web browser. It doesn't matter what operating system we're on, and again, we can be liberated from Microsoft.

[00:06:09] Now these two companies realized, if we're both going after Microsoft we'd probably better work together because if we don't. Microsoft play us off against each other and we'll both lose. So they form an alliance, and the first thing they agree on is that Netscape adds Java to the web browser.

[00:06:28] And in exchange for that, Sun will drop their hot java browser, which wasn't very complete anyway. So Chuck, that's easy to agree to. Step number two, Sun says you have to kill LiveScript because that's an embarrassment. We're seeing that Java is the last programming language you'll ever need.

[00:06:48] You can't then also be introducing another new language you're just making us look at that. So kill it. Netscape refused to kill it for two reasons. One is they wanted a language for beginners and Java and that language you need a lot of specific knowledge about Java just to write hello world.

[00:07:06] They wanted something with a much lower barrier to entry but there's also a practical problem. They wanted to launch the new browser right away and so the way they put Java in was they had Java talk to LiveScript through an interface called LiveConnect. So LiveScript could talk to the browser Java can talk to LiveScript through LiveConnect and if they took LiveScript out, Java wouldn't work.

[00:07:38] And so, in order to get Java in there they'd have to delay the launching of the new browser and they didn't want to do that, because they were on Internet time and they couldn't afford to wait that long. So their alliance was at an impasse and almost failed when one of the founders of Netscape maybe as a joke suggested that they change the name of LiveScript to JavaScript.

[00:08:02] And that they position it not as a new language but as a subset of Java, interpreted Java, which was silly because Java was interpreted Java. It was Java's stupid little brother. So they went out and held a press conference in which they lied about the relationship of these two languages.

[00:08:22] And echoes of that lie still reverberate pretty loudly through the Internet. Meanwhile, Microsoft has noticed that there are these two companies in California that are getting ready to destroy Microsoft. And they weren't ready for that yet. So Microsoft had completely missed the web in the Internet. They thought the future of telecommunications was going to be fax and cable TV.

[00:08:47] So they went out, they bought a browser company. It was another spin-off out of Illinois called Spyglass. Took their thing, relabeled it as Internet Explorer, and decided we need to get one of these JavaScript things too. So they put a team on reverse engineering the first JavaScript engine.

[00:09:05] Now it turns out ten days is way too short a time to design and implement a programming language, and there are lots of errors, lots of bugs, lots of design defects, lots of blunders. The Microsoft team discovers and carefully documents all of them and replicates them. Now usually, when Microsoft goes to knock something off, they can't help doing their own thing to it.

[00:09:31] For example, when Bill Gates told them I want a Macintosh they built Windows, okay? He didn't ask for Windows he asked for Macintosh and that's how goes there but on this case they got it exactly right. And in fact, they were able to keep the write once run everywhere promise that Java was failing to keep.

[00:09:55] And in fact, having not done that, we wouldn't be talking about this language today but will get to that later. So but they couldn't call it JavaScript because Sun had claimed ownership of the JavaScript trademark. Even though they had nothing to do with the development of the language because they claimed to own the word Java.

[00:10:13] And in fact, they were shaking down coffee companies to daring to have the world java in their URLs, this is true. So, they call it JScript, just as they call their implementation of Java J++, because they couldn't get a license to use the trademark. So, now Netscape is alarmed that Microsoft is going to embrace and extend us, so we're gonna lose control of JavaScript.

[00:10:40] What are we gonna do? We need to make a standard, so they went to W3C, and said, W3C, we have developed a programming language for the web. We'd like you to help us make it a standard. Now turns out W3C had been waiting for a chance to tell Netscape to go to hell.

[00:10:57] So they told Netscape to go to hell. So Netscape then went to ISO. Eventually they end up with the European Computer Manufacturers Association. Which is a long way to go for a California software company. But ECMA agrees, yes we'll help you make a standard. So they convene a committee.

[00:11:14] Microsoft joins the committee, Microsoft dominates the committee. Basically, the standard is based on Microsoft's Notes that they made in reverse engineering the original JavaScript interpreter. And they insist that all of those bugs, all those blunders, all those defects remain in the standard where they still exist today. So, there's a lot that's intentionally wrong which will never be repaired.

[00:11:46] Now, when they want to publish it was what we call the standard, they can't call it JavaScript because it's a sun trademark. So, they kick around other titles, web script, net script, they can't agree so, it's published with the working title. ECMAScript which is maybe the worst name ever put on a programming language and confusion still exists today what's the difference between JavaScript, J-Script ECMAScript.

[00:12:10] There are people out there who think that they are three remarkably similar but different now languages. No, their three silly names for one silly language, so JavaScript is a standardized language. The edition that is in most versions of IE is the Third Edition which was published in December of 1999.

[00:12:35] Before that one was finished work began on a fourth edition which went on for ten years and was abandoned. In 2009, a fifth edition was published which defines two languages, a Strict and Default, we'll talk more about that dialect this afternoon. And then recently, the sixth edition was published and which will eventually find its way into browsers, we'll talk more about that on the third day.

[00:13:04] So where do bad parts come from? And I think there are three sources. One is legacy, a lot of what happens in any language is repeating mistakes that happened in previous languages. And most of what is wrong in JavaScript is not unique to JavaScript, it's wrong in lots of other languages too.

[00:13:23] For some reason, it just looks stupider in JavaScript, I don't know why that is the case but it is clearly the case. Another is good intentions, there are a number of features that were added to the language to make it easier which failed to make it easier. Things like with semi-colon insertion, type coercion, when imply global variables were all intended to make the language easier for people but they actually make it much harder at least for professional programmers.

[00:13:49] And then haste, ten days is just way too short a time to design and implement a programming language. Brendan did not intend for his proof of concept to be shipped as a product but Netscape did that. I think that was inexcusable and he suffered for that. It was an unfortunate thing, so for the most part are give you a comparison.

[00:14:16] Maybe the best designed programming language in history was Smalltalk 80. Xerox PARC spent a decade designing, refining, testing, improving that language. They spent almost as many years as Netscape spent days in assigning the language. And I think Xerox got it right even though the community did not agree.

[00:14:43] So for the most part the bad parts can be avoided which is great. The problem with the bad parts isn't that they are useless it's they are dangerous