mercredi 23 janvier 2019

Reading the statement "if (x[i][0])."

I would like to ask a question regarding an IF statement.

Like what is stated from the title, how does the "for" and "If(x[i][0])" works? The code looks something like this.

var dataws1 = source.getRange(1,1,Alast,source.getLastColumn()).getValues(); 
var outData = [];
for (var i in dataws1) {
  if (dataws1[i][0] == criteria) { 
    outData.push(dataws1[i])
  }
}

From my understanding, the current IF checks the 1st column if it matches with the criteria, then places it inside the array of outData. I tried changing some of the values of the IF to check the other columns but to no avail. I'm still not familiar with Java scripting and I wish to learn more on how to read and on how it works. Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire