Introduction to JavaScript

JavaScript - Chapter 1

JavaScript Tutorial

We appreciate your patience while we actively develop and enhance our content for a better experience.

Sample Code
<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Simple JavaScript Example</title>
        body {
            font-family: Arial, sans-serif;
            background-color: #f0f0f0;
        h1 {
            color: #4a86e8;
            text-align: center;
        p {
            font-size: 1.2em;
            text-align: justify;
            padding: 10px;
        button {
            background-color: #4a86e8;
            color: white;
            font-size: 1em;
            padding: 10px 20px;
            border: none;
            cursor: pointer;
        button:hover {
            background-color: #2e5cb8;
        function changeHeaderColor() {
            var header = document.getElementById("main-header");
            var colors = ["#4a86e8", "#2e5cb8", "#8a2be2", "#7fff00", "#dc143c"];
            var randomColor = colors[Math.floor(Math.random() * colors.length)];
   = randomColor;
    <h1 id="main-header">My First JavaScript Webpage</h1>
    <p>Welcome to my first JavaScript webpage! Let's learn some HTML5, CSS3, and JavaScript together.</p>
    <button onclick="changeHeaderColor()">Change header color</button>