Skip to content

Chapter 1 of 8

JavaScript Foundations

JavaScript is a high-level, interpreted programming language that runs in every modern browser and is the scripting language of the Web. It was created by Brendan Eich in 1995 while he was working at Netscape, and the language went through several early names—Mocha, then LiveScript—before it became JavaScript. JavaScript follows the ECMAScript specification, which defines the core features of the language. The latest stable version of that standard is ES2023, and JavaScript engines implement every ES feature plus additional browser-specific ones.

To run JavaScript in a web page, you embed it using the <script> tag. The script can be written inline directly between the opening and closing tags, or it can be loaded from an external file with an attribute like <script src="script.js"></script>. Placing the script just before the closing </body> tag is a common best practice because it lets the browser parse the HTML first, improving perceived performance. For day-to-day work, console.log() is the developer's main debugging tool: it prints messages to the browser console and accepts multiple arguments of any type, such as console.log('Hello', 42);.

All chapters
  1. 1JavaScript Foundations
  2. 2Variables, Types, and Operators
  3. 3Control Flow and Functions
  4. 4Data Structures and ES6 Syntax
  5. 5Scope, Hoisting, and Closures
  6. 6Objects, Classes, and Built-in APIs
  7. 7Asynchronous JavaScript
  8. 8Browser Interaction and Best Practices

Drill it

Reading is not remembering. These come from the Javascript Fundamentals deck:

Q

What is JavaScript?

JavaScript is a high-level, interpreted programming language primarily used for web development to make web pages interactive. It is the scripting language of t...

Q

Who created JavaScript and in what year?

JavaScript was created by Brendan Eich in 1995 while working at Netscape. It was initially called Mocha, then LiveScript, before being renamed JavaScript.

Q

What is ECMAScript?

ECMAScript (ES) is the standardized scripting language specification upon which JavaScript is based. The latest stable version is ES2023, with JavaScript implem...

Q

How do you include JavaScript in an HTML file?

Use the &lt;script&gt; tag in the HTML, either inline with code between tags or externally via &lt;script src="script.js"&gt;&lt;/script&gt;. Place it before th...