Lesson 1: What Is JavaScript?

Introduction to JavaScript

JavaScript is a programming language that allows you to create interactive features such as:

  • Responding to user actions (e.g., clicks, input).
  • Updating webpage content dynamically.
  • Validating form inputs.

Where to Write JavaScript

Inline JavaScript
<button onclick="alert('Hello, World!')">Click Me</button>
Internal JavaScript

Inside a <script> tag in your HTML file:

<script>
  alert('Hello from internal script!');
</script>
External JavaScript

Linking a separate .js file:

<script src="script.js"></script>
    Example of script.js:
    console.log('Hello from external script!');