Your first JavaScript
Lecture notes
JavaScript is the programming language of the web. HTML describes the structure, CSS the presentation and JavaScript the behaviour: what happens when a user clicks, types or scrolls. It runs in every browser, and also on servers (Node.js) and in mobile apps.
Adding JavaScript to a page
<!-- at the end of <head>, with defer -->
<script src="app.js" defer></script>
The defer attribute downloads the script without blocking the page and runs it once the HTML is parsed, so your code can find every element. Keep JavaScript in separate .js files rather than inside HTML attributes.
The developer console
Press F12 (or right-click → Inspect) and open the Console tab. console.log("Hello") prints a value there; errors appear in red with the file name and line number — always read them first when something does not work.
Statements and comments
// a single-line comment
/* a comment
on several lines */
console.log("Welcome to ACADEXXA"); // a statement ends with ;
JavaScript is case-sensitive: total and Total are two different names.