CODE PATH
PRO ACCOUNT

Master Code
On The Go

Learn. Practice. Build.

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.

"HTML is the skeleton, CSS is the skin, and JavaScript is the muscle that makes everything move."

🌐 What is JavaScript?

📍 Where Does JavaScript Run?

🌐 In the Browser

Chrome, Firefox, Safari, Edge — all have a JavaScript engine (V8, SpiderMonkey).

💻 On the Server

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().

first.js
console.log("Hello, World!");
// 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.

Click "Run Code" 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:

<script>
  console.log("Hello from the script tag!");
</script>

2. From an external file:

<script src="script.js"></script>

⚠️ 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:

  1. Your name.
  2. Your favourite programming language.
  3. The result of 25 × 4.

📚 What's Next?

In the next lesson, you'll learn about:

📤 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
← Back to JavaScript Course Hub