What is JavaScript?
JS Basics
Preview
The language of the web
JavaScript adds behaviour to web pages. Unlike HTML and CSS it is a programming language — you give the browser instructions.
Adding JS to a page
<script src="script.js" defer></script>\n\n// inside script.js\nconsole.log("Hello from JavaScript!");The console
Open DevTools (F12) → Console. console.log() prints values here — your number-one debugging tool.
Your first lines
let name = "Ama";\nconst age = 25;\nconsole.log(name, age);Statements & comments
// single-line comment\n/* multi-line\n comment */\nlet x = 5; // statement ends with ;Tip: Press F12 in any browser and type code directly into the Console to experiment instantly.
This is a free preview lesson
Enroll in the JavaScript Fundamentals to unlock every lesson, lesson PDF guides, quizzes and your certificate - and start creating your own pieces today.