Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-sonnet-4-20250514· AnthropicHugging Face LMArena Human Preference 140K

Create a JavaScript hello world function

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Claudeclaude-3-7-sonnet-20250219-thinking-32k’s answer.
  1. User

    Create a JavaScript hello world function

  2. Claude Assistant

    Here's a simple JavaScript "Hello World" function:

    function helloWorld() {
        console.log("Hello, World!");
    }
    
    // Call the function
    helloWorld();
    

    You can also create it as an arrow function:

    const helloWorld = () => {
        console.log("Hello, World!");
    }
    
    // Call the function
    helloWorld();
    

    Or if you want it to return the string instead of logging it:

    function helloWorld() {
        return "Hello, World!";
    }
    
    // Call and use the function
    console.log(helloWorld());
    

    All of these will output "Hello, World!" when executed in a JavaScript environment like a browser console or Node.js.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.