Module 1: Getting Started with JavaScript
Introduction to JavaScript
Understand JavaScript, its role on the web, and how the language differs from Java.
JavaScript is a programming language used to add behaviour to websites and to build applications beyond the browser. In a browser it can respond to clicks, update page content, validate forms, and call web APIs. With runtimes such as Node.js, JavaScript can also run on servers and command-line tools.
JavaScript and Java are different languages despite their similar names. JavaScript is dynamically typed: a variable can refer to values of different types over its lifetime. Java is generally statically typed. JavaScript also treats functions as values and uses prototypes for object delegation.
What you will learn#
This course moves from syntax and data types through functions, arrays, objects, the DOM, asynchronous code, tooling, projects, and interview preparation. You can follow the syllabus in order because later lessons build on earlier concepts.
A first expression#
console.log("Hello, JavaScript!");
console.log(2 + 3);
console.log writes values to the developer console. The first statement logs text; the second evaluates an arithmetic expression and logs 5.
Where JavaScript runs#
- Browser: interact with web pages and browser APIs.
- Node.js: run JavaScript outside the browser, including scripts and server applications.
- Other embedded runtimes: some tools embed JavaScript to support scripting.
Practice#
In your own words, explain two things JavaScript can do in the browser and one thing it can do with Node.js. Then run the two examples above.