Skip to main content

JavaScript for Beginners

JavaScript is a dynamic interpreted language that is primarily used in web browsers, but can also be used outside a browser environment. It was created in the mid-1990s by Brendan Eich at Netscape, and takes inspiration from the Java, Scheme, and Self languages. Since then, it has grown from a tiny scripting language to the world's most popular language. It's definitely not a "toy" - it can be used to write anything from small scripts to HTTP server applications to complex client-side web apps with hundreds of thousands of lines of code.

JS is multi-paradigm - it can be used for Object-Oriented Programming similar to Java or C#, but can also be used in a Functional Programming style as well.

Compared to many other languages, JS is very different:

  • No built-in module definition system (until ES6)
  • No built-in private / public encapsulation
  • Prototypal-based inheritance system unlike most languages
  • No static type declarations or compilation
  • Dynamically modified objects and data
  • Minimal standard library
  • Variations in browser capabilities
  • Entire codebase has to be shipped to the browser every time a page is loaded, then parsed and executed

Runtime Environments


JavaScript was originally invented to give web browsers the ability to have interactive logic running inside a web page. By the mid 2000s, all browsers included a JS interpreter, and developers were starting to write larger client-side applications in JS.

In 2009, Ryan Dahl announced Node.js - a JS runtime for executing JS outside of a browser environment. Node is built on top of Chrome's V8 JS engine, and adds a standard library of APIs for things like working with the local filesystem, network sockets, and more. Node also popularized the CommonJS module format and the NPM package management tool.

Today, JS is widely used in multiple environments for many kinds of projects. The primary use cases are interactivity in web pages, full web app clients, web app servers, and build tools.

So, some JS code is meant to run exclusively in a browser, some is meant to run exclusively under Node, and some code can work in both environments.

Ref: JavaScript for Beginners