Home > OS >  Check values in array without using a loop
Check values in array without using a loop

Time:05-11

i'm trying to check two values and if they are met do something if not obviously throw an error. Now the problem im having is that the array needs to be completely checked before the error has to be thrown. EX:

  • in my sheet i have a letter d
  • in my array CODELIJST i have the following values - [a,b,c,d,e,f,g]
  • when we loop the first time the else statement is active because d != a -> how can i loop trough whole array and if the value is not there throw an error?
    (let u=1; u < CODELIJST.length;   u){
     if (CODELIJST[u][0]==shift) {
      var testvar2 = CODELIJST[u][1];
     }else{
     // throw error if value is not found
     }
    }

The Array is two dimensional thats why im only looping through with var u

CodePudding user response:

You can use a enter image description here

  • Related