Looking for a more efficient way to write an 'or' list of game variables

I'm looking for a way to write a long 'or' list of $gameVariables without having to write the whole thing out each time:
  • while (get == $gameVariables.value(100) || get == $gameVariables.value(101) || get == $gameVariables.value(102));
The (very short) code I need it for is below. Also, if there is a better way to do the whole block I'd be more than happy to take advice. Thanks in advance.

-Beth

Spoiler: Code
var questGet = function() {

do {
var get = Math.floor(Math.random() * whichHouseSpring.length)
} while (get == $gameVariables.value(100) || get == $gameVariables.value(101) || get == $gameVariables.value(102));

return get

};
var startValue = 100;
var endValue = 150;
for (i=startValue; i <= endValue; i++){
if ($gameVariables.value(i) == get){
//code here;
break; // or i=endValue+1;
}
}

Or maybe one function and checking in while if it is return true vaule?

Or pushing ids of variables in array ex var variablesArray = [1001,234,212,34]; ??
Assuming whichHouseSpring is some global array.
Code:
function getQuest() {
    "use strict";

    var gameVars = [100, 101, 102];
    var get = Math.floor(Math.random() * whichHouseSpring.length);
    var isEqual;

    isEqual = gameVars.some(function (value) {
        return get === $gameVariables.value(value);
    });

    if (isEqual) {
        return get;
    }
}
Thank you both for the replies. I ended up using the '.some' method from Clock Out. I'd not seen it before so double thanks for teaching me something new! 🙂

-- Beth
A one line version would be
Code:
if ([1, 2, 3].contains(number) {
   // Do stuff
}
This would be true if the number is one of the 3 numbers in the array.

Original thread: https://forums.rpgmakerweb.com/threads/looking-for-a-more-efficient-way-to-write-an-or-list-of-game-variables.83497/