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

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -