I'm trying to make a silly but simple little program in google apps script and sheets where it picks a random dad joke to show you every couple of seconds. I tried using setInterval()
, but I found out that it isn't included in google apps script. Any suggestions?
code:
function LOL() {
let messageList = ["Where do dads keep their jokes? In a dad-abase!","When does a joke become a dad joke? When it becomes a-parent!","Two men walk into a bar. You'd think the second one would've noticed!","Does your face hurt? 'Cause it's killing me!"]
function randInt() {
let listLength = messageList.length
let random = Math.floor(Math.random() * listLength);
return random
}
function showMessage() {
let int = randInt()
console.log(int)
return messageList[int]
}
return showMessage()
}
It would choose a random message from my list every minute to put in whatever cell has =LOL()
.