Tutorials

JavaScript Tutorial

All Tutorials Learning Tools Login

JavaScript Tutorial · Chapter 2 of 8

JavaScript Intro

What JS does in the browser.

HTML is structure. CSS is style. JavaScript is behavior.

Beginner JS often starts with variables, functions, events, and DOM changes.

Intro sample Try it Yourself »
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>JS Intro</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <h1>JavaScript Intro</h1>
    <p id="status">Waiting...</p>
    <button id="runButton">Run Demo</button>
    <script src="script.js"></script>
</body>
</html>
style.css
body {
    font-family: Arial, sans-serif;
    padding: 32px;
}

button {
    padding: 10px 14px;
    border: 0;
    border-radius: 8px;
    background: #a16207;
    color: white;
}
script.js
document.getElementById("runButton").addEventListener("click", function () {
    document.getElementById("status").textContent = "JavaScript is running.";
});

Classroom Tips

  • Open script.js to see the behavior.
  • Run the preview and click the button.