Quest 1 • Lesson 1
⚡ Introduction to JavaScript
Discover what JavaScript is, where it runs, and write your very first line of code.
JavaScript is the programming language of the web. While HTML provides the structure and CSS handles the styling, JavaScript adds interactivity and behaviour — button clicks, form validation, animations, games, and much more.
🌐 What is JavaScript?
- High‑level language — easy to read and write.
- Interpreted — runs directly in the browser without compilation.
- Dynamic — can change the page in real‑time.
- Versatile — runs in browsers AND on servers (via Node.js).
📍 Where Does JavaScript Run?
Chrome, Firefox, Safari, Edge — all have a JavaScript engine (V8, SpiderMonkey).
Node.js lets JavaScript run outside the browser — for APIs, tools, and back‑ends.
✍️ Your First Line of JavaScript
The simplest way to output text is with console.log().
// Output: Hello, World!
Try it yourself in the interactive runner below 👇
🚀 Try JavaScript Live
Edit the code below and click Run to see the output.
💡 Try this: Change the text inside the quotes, or try console.log(10 * 5) to see JavaScript do math!
🔗 How to Add JavaScript to HTML
There are two common ways:
1. Inside a <script> tag:
console.log("Hello from the script tag!");
</script>
2. From an external file:
⚠️ Common Mistakes
❌ Forgetting the semicolon
JavaScript often works without semicolons, but adding them is good practice to avoid errors.
console.log("Hello") // Works, but better with semicolon
console.log("Hello"); // ✅ Best practice
❌ Using reserved keywords as variable names
Words like let, const, function, and class cannot be used as variable names.
💡 Pro Tips
Use the browser console for quick testing.
Press F12 in any browser, click the "Console" tab, and type JavaScript directly. It's the fastest way to experiment.
Comment your code with // or /* */
Comments help you and others understand what your code does.
// This is a single-line comment /* This is a multi-line comment */
✨ Challenge: Print Your Introduction
Use console.log() to print:
- Your name.
- Your favourite programming language.
- The result of
25 × 4.
console.log("My favourite language is JavaScript");
console.log(25 * 4); // 100
📚 What's Next?
In the next lesson, you'll learn about:
- Lesson 1.2: Variables & Data Types → — store and use data.
- ⚡ JavaScript Course Hub → — see all lessons.
📤 Share This Lesson
Help others start their JavaScript journey!
❤️ Support Free Education
This course is 100% free. If it helps you, consider buying me a coffee.
☕ Buy Me a Coffee