🤯 50% Off! 700+ courses, assessments, and books

5 Common Myths About JavaScript

    Craig Buckler

    Despite being the world’s most widely-used programming language, JavaScript is the most misunderstood and undervalued. The situation has improved during the past few years, but these myths still permeate the IT world.

    1. JavaScript == Java

    UK developer Jeremy Keith devised the best explanation:

    Java is to JavaScript as ham is to hamster

    The names are confusingly similar but Java and JavaScript are not related. There are a number of superficial similarities, but the same can be said for any language adopting a C-like syntax.

    The language was originally named Mocha, became LiveScript, and finally JavaScript at a time when Java was heralded as the savior to life, the universe and everything. The name reflected Netscape’s marketing efforts — not any underlying relationship.

    2. JavaScript is a “toy” language

    The “script” part of the name gives the impression that JavaScript is some type of cut-down, macro-like or less capable version of Java. It’s not. If anything, popular JavaScript features such as closures and lambda functions are now finding their way into other languages (PHP, C# and Java itself).

    JavaScript is most commonly found as a browser-based interpreted language, but that doesn’t mean it’s any less powerful or competent than an OS-based compiled language.

    3. JavaScript is only found in browsers

    Most people experience JavaScript as an embedded browser language but it (or languages based on the ECMAScript standard) can be found in many other places, e.g.

    • Mozilla’s Firefox browser and Thunderbird email client use JavaScript for some application processes
    • Flash ActionScript is based on JavaScript
    • PDF files can have JavaScript embedded
    • many Microsoft and Apple desktop widgets use JavaScript
    • OpenOffice.org provides JavaScript support
    • webOS, used in Palm mobiles, uses JavaScript for its application framework
    • JavaScript can be used as an application programming language on the GNOME desktop and as a scripting language in Windows.

    JavaScript does not have a strong server-side presence but several dozen implementations exist. The day we’ll be able to develop JavaScript on the client and the server can’t come soon enough!

    4. JavaScript is inconsistent and buggy

    Those days are long gone. Browser vendors adhere to an agreed standard (ECMAScript) and JavaScript-specific issues are rare.

    However, browser features are not always consistent: DOM manipulation particularities, event handling idiosyncrasies, and browser quirks all cause development headaches. That’s not a fault with the language itself, but the browser objects you can access with JavaScript.

    5. JavaScript is not object-orientated

    Confusion arises because JavaScript does not provide obvious class-orientated inheritance. The lack of a ‘class’ keyword causes many developers to assume JavaScript is a functional language.

    JavaScript offers prototypal inheritance. The real beauty is that you can write functional language code or use classical inheritance patterns with private properties and methods.

    Furthermore, everything in JavaScript is an object — including native types and functions. How many other languages offer constructs such as:

    var x = new Number(123);
    var opp = "oops".substr(0,3);
    var f = function() { return function() { alert("hello!"); }; };

    What about passing a function as a parameter (it’s just another object)…

    var Add = function(a, b) { return a + b; };
    function Calculate(func, a, b) {
    	return func(a, b);
    var s = Calculate(Add, 1, 2); // s = 3

    Or perhaps extending native types…

    // reverse any string
    String.prototype.Reverse = function() {
    	return this.split("").reverse().join("");
    var h1 = "Hello!";
    var h2 = h1.Reverse(); // !olleH

    JavaScript can be a little confusing at first but you’ll miss its elegance and power when you return to other languages.

    Still don’t believe me? Did you sign up for Kevin Yank’s JavaScript Live course? I’ll see you in the forums.