<aside> 💡

This is where it all starts. Variables, logic, and decisions. Every program ever built begins here.

</aside>

1. Setup + Hello World

JavaScript runs inside the browser.

Inline — put it before the closing </body> tag

<body>

  <!-- your HTML here -->

  <script>
    console.log("Salaam, World!");
  </script>
</body>

External file — link it the same way

<body>

  <!-- your HTML here -->

  <script src="script.js"></script>
</body>
// script.js
console.log("Salaam, World!");

Open DevTools

OS Shortcut
Windows / Linux F12 or Ctrl + Shift + J
Mac Cmd + Option + J

→ Click the Console tab to see output

Mental model: JavaScript = instructions the browser runs step by step


2. Variables

Variables store values you want to reuse.

let name = "Ahmed";
let age = 25;

Use let when the value changes:

let score = 10;
score = 20;
score = 30;

Use const when the value should NOT change: