JSFiddle - React, Tailwind, and code Playground

by David Thomas

JavaScript

function returnRandomValue (){
    var values = ["someval1", "someotherval1", "someval2", "someval3", "tomato", "Pumice", "Spaghetti", "USS Enterprise", "Endymion", "Talkin' 'bout my generation", "Lorem ipsum", "running out of ideas, now..."];
    return values[Math.floor(Math.random() * values.length)];
}


var mya = ["someval1", "someotherval1", "someval2", "someval3"],
    returnedFunctionValue = returnRandomValue();

mya.forEach(function(a, b){
    if (a === returnedFunctionValue) {
        console.log('Found "' + returnedFunctionValue + '" at index ' + b);
    }
});