Sense Space JavaScript

<!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Random Sense and Room</title>
    body {
      font-family: Arial, sans-serif;
      text-align: center;
      margin-top: 100px;
    button {
      font-size: 18px;
      padding: 10px 20px;
  <h1>Random Sense and Room</h1>
  <p id="sentence"></p>
  <button id="runButton">Run</button>

    const senses = [
      "cold thermoception",
      "heat thermoception",

    const rooms = [
      "living room",
      "laundry room"

    function getRandomInt(min, max) {
      min = Math.ceil(min);
      max = Math.floor(max);
      return Math.floor(Math.random() * (max - min + 1)) + min;

    function generateSentence() {
      const randomSense = senses[getRandomInt(0, senses.length - 1)];
      const randomRoom = rooms[getRandomInt(0, rooms.length - 1)];
      const sentence = `How would you use ${randomSense} for a ${randomRoom}?`;
      document.getElementById("sentence").innerText = sentence;

    document.getElementById("runButton").addEventListener("click", generateSentence);

Leave a comment