A simple Hello World script to get started with JavaScript. Perfect for beginners learning the basics.

Code

// Hello World Script
console.log('Hello, World!');

function greet(name) {
    return `Hello, ${name}!`;
}

// Test the function
const message = greet('Noxy');
console.log(message);

// Display in browser
document.body.innerHTML = `
    <div style="
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
        font-family: system-ui;
        font-size: 3rem;
    ">
        ${message}
    </div>
`;

Usage

  1. Copy the code above
  2. Open your browser console
  3. Paste and run
  4. See the greeting!