JavaScript Tutorial · JavaScript Basics · Lesson 1 of 44

JavaScript Introduction

What JavaScript is, where it runs and why every web developer needs it.

What is JavaScript?

JavaScript (JS) is the programming language of the web. Every modern browser runs it, and with Node.js it also runs on servers, in command-line tools and in desktop apps.

  • HTML describes the content of a page.
  • CSS describes how it looks.
  • JavaScript makes it do things — respond to clicks, validate forms, load data, animate, and much more.

Your first program

Hello, World!Try it yourself
console.log("Hello, World!");

Output

Hello, World!

console.log() writes a value to the console — the output panel in your browser's developer tools (press F12), the terminal in Node.js, or the output box under each example on this site.

JavaScript is not Java

Despite the name, JavaScript has nothing to do with Java. The language is officially standardised as ECMAScript; new versions arrive every year (ES2015 — often called "ES6" — was the big modernisation). This tutorial teaches modern JavaScript: let/const, arrow functions, classes, modules and async/await.

Test yourself

Which function prints a value to the console in JavaScript?

  1. print()
  2. echo()
  3. console.log()
  4. System.out.println()
Show answer

Answer: console.log()

console.log() is JavaScript's standard way to print. print() is Python, echo is PHP.