javascript - If getValue equals this or that -
how getvalue of multiples? if equals or that?
i've tried , doesn't act expect.
range.getvalue() == "yes" || "no" || "repeat"
basically want avoid this
if (sheet.getname() == sheettowatch && range.getcolumn() == purchasedcolumn && range.getvalue() == "yes") { copyrow(); } else if (sheet.getname() == sheettowatch && range.getcolumn() == purchasedcolumn && range.getvalue() == "no") { copyrow(); } else if (sheet.getname() == sheettowatch && range.getcolumn() == purchasedcolumn && range.getvalue() == "repeat") { copyrow(); }
function isin(x, a) { return a.indexof(x) > -1; } if (sheet.getname() == sheettowatch && range.getcolumn() == purchasedcolumn && isin(range.getvalue(), ["yes", "no", "repeat"])) { copyrow(); }
isin takes value , array of possible values , checks if value in array.
of course put indexof in condition.
Comments
Post a Comment