27

In ancient history, Brendan Eich had a language design, and in today's world, JavaScript is a popular language implemented and used in many different places.

What caused the language to become popular? Was it the C-like syntax familiar to previous programmers? Did Netscape have enough control of the market to force it to be used? Or is there some deeper reason that JavaScript is popular and other languages are not?

Particularly, if you had to make a language as popular as JavaScript, what initial conditions would you need to recreate its growth in popularity?

Shog9
  • 8,101
  • 2
  • 46
  • 56
Mathnerd314
  • 389
  • 3
  • 5

12 Answers12

39

It's pretty simple: Netscape used a JavaScript engine in their browser. If you wanted to do scripting on the web, JavaScript was it. Internet Explorer had (and still has) both JavaScript and VBScript, but obviously if you want to work in more than just IE you have no choice but to use JavaScript.

JavaScript is a great language in its own right, but it would be nowhere near as popular today if it weren't for the fact that it's the only language you can use to script HTML.

Shog9
  • 8,101
  • 2
  • 46
  • 56
Dean Harding
  • 19,911
32

I was commenting on an earlier answer, but it was getting big, so I thought I'd spin this out.

Any new language can only succeed if it capitalizes on an emerging frontier in computing.

Previous examples:

  • C for Unix
  • Objective-C for iOS
  • Perl and PHP for back-end Web 1.0
  • Python and Ruby for back-end Web 2.0
  • Java for the back-end Internet-enabled enterprise

To answer your question, JavaScript was the language for Netscape Navigator back when that was the dominant browser. Specifically, it was the language for dynamic front-end development.

The next big language will have to solve another frontier. There still seems to be a land grab in the back-end web development space. Plus, mobile computing isn't totally solved, despite Apple's current dominance. Also, there's the emergence of multi-core and cloud computing, which is something that many languages are attempting to capitalize on (like concurrent languages like Erlang and Go, or functional languages like Haskell and OCaml).

Entrepreneurs have an expression along the lines of, "find a someone on fire and sell him a fire hose". So if you want to introduce a new language, whose fire are you putting out? Every new frontier in computing brings a whole host of headaches; so supply some aspirin and you'll be golden.

chrisaycock
  • 6,655
8

I'm going to add an update to this because I think JS's emergence on the client-side web has been misunderstood on a few key points over the years.

It wasn't Ajax

I'm not saying Ajax wasn't important to the evolution of understanding of JS as a language but the fight for client-side browser dominance was over long before the term Ajax was coined.

It wasn't because it was the only game in town

There were Java Applets, Flash, and VBScript. I've heard there were even other scripting options in the '90s (but required plug-ins IIRC). Java is hugely popular yet applets were a dismal failure. They were ugly and often security-swiss-cheese but more importantly I don't think Java was a good fit for reasons I'll go into later. Flash was very popular and had a strong foothold for a number of years but even when Flash finally had SEO options, they weren't typically used, making exclusively Flash sites very hard to discover. Even now, most of us regularly update Flash so we can see movies but that's the real Achilles heel. Proprietary technology in browsers is annoying. And of course VB, which would only ever work with IE, so no.

Right Place at the Right Time is Relevant But Not the Whole Answer

Yes, without the web wave to ride we may never have seen JavaScript or a language in popular usage like it as soon as we did. Or maybe we would have...

It Ended Up Being the Perfect Tool for the Problem Domain

I'd say around 2000ish we had the following problems:

  • IE and Netscape had only just agreed to start playing nice by attending to the same DOM API and CSS standards and we've had to deal with a crap-ton of legacy JS cross-browser issues ever since which are only just starting to become manageable without the aid of JS DOM normalization tools like jQuery post IE8
  • There was a whole new generation of web developers/designers who weren't all necessarily heavyweights as programmers looking to improve their game post-.com-bubble-burst when they stopped handing you a decent salary for showing up at the door with nothing more than basic HTML-literacy and some photoshop skills.
  • There was this new CSS kid in town that offered intriguing possibilities for what would ultimately be called DHTML, (more appropriately) DOM Scripting, (now inappropriately) HTML5 (zomghtml5!).

So we needed a language that was both deep, offering the ability to actually structure and architect a more advanced app with portable/re-usable components on the client-side but also accessible to people who didn't know a lot and just needed things to appear/reappear when you clicked a button.

Furthermore, MS being the ungainly/incompetent and/or dominance-through-anti-competitive-practice-scheming beast that they sometimes are, failed to really touch their non-compliant DOM API implementation for a good solid decade, although they did manage to add the occasional thing like the original XHR object and querySelectors in IE8.

The important thing to note is that by around 2005 we had managed to so completely bury the complexity involved in handling cross-browser issues that it wasn't really a serious issue anymore on the JavaScript front. The failure to support CSS2 properly for as long as they did caused considerably more pain. For an idea of the sheer volume and depth of issues, I recommend checking out quirksmode.org. I do not think that this is a feat that could have been achieved as smoothly and in as many libraries in Java, certainly not in VB and definitely not with any plug-in strategy whose goal is to sidestep the entire issue by becoming an entirely new kind of nuisance.

Other Language Features That Make a Lot of Sense for UI:

  • First Class Functions: In my experience, nothing lends itself better to async processing and event-driven paradigms than a language that makes its functions first-class. Both concerns are regularly addressed in UI work.

  • Dynamic Types: Casting and type-checking is a very rare need in JavaScript which helped keep code concise and lean. UI concerns can get complex and messy very quickly. Keeping code tight and being absolutely clear about flow of data is critical to understanding and modifying/maintaining it.

  • It's Not Protectionist: For many years somebody's been preaching that you need to protect yourself from your own mistakes and the dumb things the other guy might do with your code by making code constructs highly rigid and inflexible and impossible to meddle with the original intent it was authored with and a lot of people have been listening. I won't say they're always wrong (might think it) but I will say it's the wrong approach to web UI and I do believe that it's something of a phenomenon that we've been cranking out, maintaining, and modifying client-side GUIs at a much faster pace and with greater ease than such work was typically accomplished in more restrictive languages in the past. Being able to change things on the fly quickly and easily makes it much easier to have dynamic/fluid architecture schemes that don't require monumental amounts of indirection and abstraction overhead which ultimately makes it easier to see what the Hell is going on in your code and pre-empt or handle exceptions much more cleanly. It is easier to maintain simply through sheer virtue of making it possible to be more direct in everything you do and with much less code than it would take given the other philosophy.

How did JS become popular? It has proven itself to be an excellent tool for the job time and time again. It is not the language we are "stuck with" It's the language that may have inspired a great deal of evolution in popular languages in general. And for that, you can thank Brendan Eich and any contemporaries who helped put the idea into his head, for liking Scheme as a design-inspiration fit for the problem at hand more than he liked Java.

Erik Reppen
  • 6,281
2

One tactic used initially was the name - "JavaScript" was intended to ride on the popularity of Java, which had then been on the rise for some while.

Grant Palin
  • 1,711
2

Right time, right place. And it didn't entirely suck.

It's the same reason facebook is winning.

Yevgeniy Brikman
  • 2,575
  • 1
  • 22
  • 23
1

Hasn't is been the only cross-browser client-side scripting language? Its popularity seems to have grown in lock-step with that of the web, which makes sense.

Ben Hughes
  • 1,999
0

You not gonna believe me, but flash and (in a little bit java applets earlier) made a huge contribution in growth of popularity of javascript and the to evolution of the language itself.

When flash came up to the scene, it was the first evidence that web applications is something worth to think about.

In some sense competition with plugins, constant attempts to show - look what we can do without plugins made javascript a language with a wider spectrum of applications, and, therefore, made it popular.

shabunc
  • 2,454
0

In my opinion, Javascript is popular because it is supported well.

First, it's the only language for both Netscape and IE in its time. After a "javascript community" is established and became stable, no one could ever think about "another good" that requires to build from scratches. They just contribute to make it better and better.

If you want to build a new popular language, the first thing I think about is that you must determine who use that language. The first customers are always hard to get, and you must make your language superior to javascript in some way or another. Maybe even in a restricted field/ restricted community of programmers, for example, "better/faster javascript engine for iPhone mobile" may be a good choice.

Moreover, your language should be easy to use and customize by community, because it's the community that determine which language could survive.

-1

I really think it has to do with its C-like syntax. According to Wikipedia Javascript appeared in '95. At that time C was at an all time high and Java was the next-and-coming language. I think the syntax was really appealing (for that time) and its name association with the next big language, Java, gave it an edge.

It allowed an easy cross over at that time for C programmers to adapt to a dynamic language.

Programming Language    Dec 2010    Dec 2005    Dec 1995        Dec 1985
Java                    1           1           -               -
C                       2           2           1               1

Tiobe Index

If I was to recreate the success of Javascript I would look at problems plaguing modern programmers and give them a solution with a familiar syntax.

IMO parallel programming is the next big problem programmers are facing. I think functional-languages really do a great job at overcoming that obstacle. If I was to create the next Javascript I would create a functional-language with a common platform. In addition I think it would need to be flexible enough to be a scirpting language but powerful enough to be a statically typed language, with a great framework.

Although not everyone may agree, under those conditions, I think F# may have a lot of merit in the future.

snmcdonald
  • 1,321
-1

I for one think people thought Javascript had to do something with Java.

(Like nowadays everything starts with an "i" )

Marketing/publicity strategy does play a significant role.

Simon
  • 425
-1

JavaScript became popular because of AJAX and good inspection tools such as Firebug. Of course the fact that it worked on all major browsers and was only way to do DHTML helped.

Basically to make even ugliest language successfull it has to be able to do really usefull thing that no other language can. Also you need to provide tools that allow programmers to really feel that they contol what language does which was not the case for javascript before firebug.

Kamil Szot
  • 144
  • 4
-4

Javascript is popular as a hack to overcome the shortcomings of HTML markup for making webpages appear like designers want them to appear. Without Javascript all webpages would look like this - HTTP 1.1. Barely a step-up from the gopher protocol.

John Alexiou
  • 153
  • 1
  • 4