Introduction to Javascript

☕ 3 min read
🏷️
  • #JavaScript
  • Introduction

    JavaScript is a programming language that was created to make webpages more dynamic. It allows webpages to react to user actions such as key presses, make network requests and modify existing content on the webpage.

    It was created in 1995 by Brendan Eich in only 10 days. Being the only language that works seamlessly with HTML/CSS and supported by all the major browsers, JavaScript has become one of the most widely used programming languages in the world.

    In the last decade, JavaScript has evolved from its browser roots to run on nearly everything - servers, embedded systems and even robots.

    ECMAScript

    A programming language needs to have strictly defined rules for it to work seamlessly across multiple environments.

    In the past, there were multiple versions of JavaScript. But there is now an official standard that defines the language. This standard is known as ECMAScript. It’s maintained by the Technical Committee 39 (TC39). The committee meets every two months to discuss and vote on proposed changes.

    JavaScript is the programming language that conforms to the ECMAScript Spec (ECMA-262).

    This spec is maintained by Ecma International. You can check out the standard, proposals, and meeting notes here.

    What’s Special About JavaScript?

    As mentioned above, it’s the only language that works perfectly with HTML/CSS and is natively supported by all the major browsers in the world.

    JavaScript also provides a lot of freedom to programmers. It’s a multi-paradigm language, which means it doesn’t enforce any particular programming paradigms such as Java (forces object-oriented programming) or Haskell (forces funcitonal programming) or C (forces imperative programming).

    JavaScript is also a dynamic, interpreted, weakly typed, dynamically typed language. These will be discussed when exploring variables, data types, and JavaScript code execution.

    Hello, World

    This is how a simple program looks like in JavaScript.

    1
    2
    3
    4
    5
    
    function helloWorld (str) {
      console.log(str);
    }
    
    helloWorld('Hello, World!');
    
    1
    
    Hello, World!
    

    This code is parsed, compiled and then executed.

    Note that console.log is not a built-in JavaScript feature but a feature provided by the browser. We will look at more such features when exploring web APIs.

    How Do I Learn JavaScript?

    The best way to learn any programming language is to dive in head first, play around and make stuff.

    If you’re just starting out, go through the basics at Codecademy and then Free Code Camp (JavaScript Algorithms and Data Structures Certification section). Once you’ve become familiar with the language, check out JavaScript30 to see the amazing things you can do in the browser.

    Here are some good books to use as reference:

    These should be enough to get you started on the right path. Happy coding!