JavaScript · Lesson 1 of 8
JavaScript introduction
What JavaScript does, where to write it and console.log.
JavaScript (JS) runs in the browser and makes pages interactive: reacting to clicks, validating forms, loading data. It also runs on servers through Node.js.
Add JS with a <script> tag — usually a file: <script src="app.js" defer></script>. defer runs it after the HTML has loaded.
console.log() prints values to the console — your main debugging tool. In the Try-it editor, console output appears under the preview.
Try it yourself
Edit the code and press Run (or Ctrl/⌘ + Enter). Code runs only in your browser, in a sandbox.
Key points
- JS adds behaviour to HTML.
- Use defer when loading scripts in <head>.
- console.log is for debugging.
Quick check
What does console.log(2 + 3) print?
2 and 3 are numbers, so + adds them: 5.
Practice task
Print your name and today's date to the console, then change the page heading to 'I am learning JavaScript'.
Interview corner
What is the difference between defer and async on a script?
Both download in parallel. defer runs after HTML parsing, in order; async runs as soon as it downloads, in any order.
Is JavaScript the same as Java?
No. They are different languages with different designs; the similar name was a marketing choice.
Further reading
Official documentation, linked for deeper study. These are outside sites; this lesson's text is our own.
Original lesson written by the InfoparkDaily team · © 2026 InfoparkDaily · Free to learn — no paid course or subscription.