Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0613· OpenAIAi2 WildChat-4.8M (AI2)

<!DOCTYPE html> <html> <head> <meta charset=“UTF-8”/> <title>GPT3 playground</title>…

  1. User
  2. Assistant

    // JavaScript code goes here

    // Example 1: Simple addition var num1 = 5; var num2 = 10; var sum = num1 + num2; console.log("The sum is: " + sum); // Output: The sum is: 15

    // Example 2: String concatenation var firstName = "John"; var lastName = "Doe"; var fullName = firstName + " " + lastName; console.log("The full name is: " + fullName); // Output: The full name is: John Doe

    // Example 3: Conditional statements var age = 25; if (age >= 18) { console.log("You are an adult"); } else { console.log("You are a minor"); }

    // Example 4: For loop for (var i = 1; i <= 5; i++) { console.log(i); } // Output: // 1 // 2 // 3 // 4 // 5

    // Example 5: Function function greet(name) { console.log("Hello " + name); } greet("Alice"); // Output: Hello Alice