how to use the randomly selected word from the array and use it in function [closed]

I am trying to make select the random array element, and then want to use the selected word in the function but after using the function again it doesnt use the other random selection word.

let word = arrayOfWords[Math.floor(Math.random() * arrayOfWords.length)];

I made this in global scope but when I try to use this when I press button for the second time it doesn’t work. it just uses the one word that selcted on first button click