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?

3
  • 2
    JavaScript was about dead (+- 2005) until Google resurrected it with Google maps.
    – Todd Moses
    Sep 16, 2011 at 13:36
  • 1
    @ToddMoses I went to argue, but some research showed you are right: AJAX made Javascript mainstream again, inspired by Gmail (2004) and google maps (2005). However (and this also relates to the above question) javascript never really went away: Actionscript (used in Flash) appeared from about 2000 and is basically the same language. During the Browser War Years, Flash/Actionscript was being used for the same things that Javascript/AJAX is the go-to-technology for now. I took my Javascript skills to Actionscript in 2000, and brought them back to Javascript in 2008 :-) Jul 10, 2012 at 1:03
  • 2
    Ajax is important but is overcredited, IMO. Widespread browser semi-compliance with the DOM API and CSS2 are what helped make JS a powerful tool on the client-side. That started more around 2002ish IIRC. Once we had proper tools for mucking with the HTML, rapid implementation of complex UI features was a whole new ballgame. It may not have been until around 2005 that everybody started to really take notice, however. I'd also say it wasn't until around 2005ish that a critical mass was beginning to understand that JS is actually a pretty badass general language in its own right. Mar 5, 2013 at 16:52

12 Answers 12

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.

7
  • 4
    I almost agree but I can't figure out how did .NET platform became so popular? Mar 13, 2011 at 9:20
  • 5
    @Tomasz Microsoft pushed .NET as the new platform for Windows (which still has the vast majority of desktop installs) and went so far as to discontinue VB 6. Mar 13, 2011 at 17:05
  • 1
    Neither Perl nor Python really owe their initial popularity to the web; they were intended as languages for quickly building tools for sys-admins or operating system services (respectively) and they were hugely successful in those domains before they gained even more traction with web development. Sep 28, 2011 at 15:24
  • 1
    @TokenMacGuy : Those domains (including CAD/CAE) were relatively small until Web 1.0 took off. That's when the shelves in the bookstores started overflowing with books on these languages.
    – hotpaw2
    Dec 2, 2011 at 19:44
  • 2
    @hotpaw2: Perl was extremely popular for scripting on UNIX some years before home internet access was at all common. Mar 8, 2013 at 20:30
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.

7
  • 3
    So, by piggybacking on an existing (popular) piece of software that needed a higher-level language? Dec 22, 2010 at 3:53
  • 7
    @Mathnerd314: It's not quite like that. JavaScript (thanks, Mr. CRT :p) was never separate from the browser: it was developed by Netscape specifically for use in their browser, so it's not like there was a concious decision to "piggyback" on Netscape's popularity in order to make the language popular. Dec 22, 2010 at 3:58
  • 2
    @Mathnerd314 It's not so much the piggybacking as it was the only real language for a new frontier of computing, just as C was for Unix. Anyone who wanted a dynamic front-end was required to use JavaScript. Dec 22, 2010 at 4:07
  • 4
    In order to recreate the success, I need to find an entirely new frontier of computing, and make the new language mandatory. I see... Dec 22, 2010 at 4:15
  • 2
    @Mathnerd314 Current emerging frontiers include multicore and cloud computing. Indeed, this is something that a language like Erlang could capitalize on. (Another example is the rise of Objective-C because of the emergence of smartphones, since Apple is such a big player in that space.) Dec 22, 2010 at 4:45
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.

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.

2

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

It's the same reason facebook is winning.

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.

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
  • The important thing is how to make it popular "enough". Then it will work itself. Dec 22, 2010 at 9:59
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.

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

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

6
  • 2
    @Mr. CRT: Anders Hejlsberg, the creator of Turbo Pascal, had a big influence on C# and the .NET framework. So I would not have discounted Pascal if Netscape had adopted Pascal. There are still tons of Delphi developers around that swear by it.
    – snmcdonald
    Dec 22, 2010 at 4:01
  • 3
    Sorry, deleted my comment before you responded - it was meant as sarcasm anyway, and therefore not particularly helpful. I should say that, while certainly helpful in getting existing programmers to "dip their toes in the water", a C-like syntax is hardly a guarantee of success. Consider Objective-C: more than a decade in relative obscurity, then Apple buys NeXT and makes it their foundation for all sorts of fun little gadgets...
    – Shog9
    Dec 22, 2010 at 4:12
  • 1
    @Mr. CRT. Very interesting comment. Syntax is definitely not the be-all, although, I think it is important to existing programmers. Objective-C does not feel very C-like to me. Perhaps that is why it did not take off initially. Yet, it might be the association with the next-up-and-coming technology that makes it relevant, such as Java was in the '90s. As for syntax, I think the next generation of programmers are becoming more comfortable with functional and dynamic languages.
    – snmcdonald
    Dec 22, 2010 at 4:20
  • @Mr. CRT: Or Python with Google, etc... I would say that "popularity" (as in, widespread) generally has little to do with the language itself (after all, there are many fantastic languages that are not very popular [eg Haskell, Erlang] and others which are butt-ugly and extremely popular [eg PHP]) Dec 22, 2010 at 4:21
  • @Dean Harding: Interesting comment because I really enjoy PHP. I appreciate that the library function names have a similarity to the C-Library and yet adopt a Perl-like syntax, without obscuring it with sigil plurality. At the same time I understand the criticism as I see the implementation of OO in both Perl and PHP as a last minute thought. PHP has a similar syntax to both C and Perl (perhaps more languages) which is familiar to a lot of programmers and yet is designed for a very popular domain. I really think it is a combination of syntax and popular technology.
    – snmcdonald
    Dec 22, 2010 at 4:28
-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.

1
  • 2
    JavaScript gained a new lease on life with AJAX (and arguably Firebug, though I think that's secondary), but it had won the war before it started (and almost fifteen years ago) because there was no competition in its space.
    – wyatt
    Dec 22, 2010 at 15:49
-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.

1
  • 2
    Protocol != design != scripting. You can make quite beautiful pages without Javascript using HTTP 1.0.
    – deceze
    Dec 22, 2010 at 3:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.