JSFiddle - React, Tailwind, and code Playground

by bluey

JavaScript

var getRandomWord = (function () {
  var gameWordArray = [];
  gameWordArray.push("Stop sending people to kill me! We've already captured five of them, one of them with a bomb and another with a rifle... If you don't stop sending killers, I'll send a very fast working one to Moscow and I certainly won't have to send another.");
  gameWordArray.push("When this war is over, the Japanese language will be spoken only in hell!");
  gameWordArray.push("They’ve got us surrounded again, the poor bastards.");

  return function () {
    var randNum, finalWord;
    randNum = Math.floor(Math.random() * gameWordArray.length);
    finalWord = gameWordArray[randNum];
    return finalWord;
  };
})();

alert(getRandomWord());