JavaScript Tutorial

JavaScript Getting Started

Run JavaScript in the browser console and inside a web page.

Concept

JavaScript can run directly in modern browsers. For quick experiments, use the developer console; for page behavior, use a script element or external .js file.

Keep JavaScript separate from presentation where practical. Browser scripts can read and change the DOM after the relevant elements exist.

Example

const message = "Hello JavaScript";
console.log(message);
Type the example yourself and change at least one value. Small experiments reveal syntax and behavior faster than passive reading.

Practice Tasks

  1. Open the browser console and print your name.
  2. Create an HTML file and load an external app.js file.
  3. Use console.log for three different value types.

Key Takeaways

  • The browser includes a JavaScript engine.
  • Developer tools are essential for debugging.
  • External scripts keep code maintainable.