Context: I'm creating a tbody table from a data file, and I'd like to apply a format to certain columns. It works just fine if I leave out the conditional in which I check the column number. In order to rule out other problems in that part of my code, I've stripped it way down. What I still can't figure out is why the always-true if statement just doesn't fire.
Stripping out the superfluous stuff, this code works:
Object.values(dataRow).forEach((val) => {
let cell = row.append('td');
cell.text(val);
}
But this doesn't:
Object.values(dataRow).forEach((val) => {
if (true) {
let cell = row.append('td');
}
cell.text(val);
}
To clarify, as long as I don't have the if statement in there, my td cell is populated as I expect it to be. But with the conditional included, nothing happens.
What am I missing? JavaScript isn't my first language, so maybe I'm missing something truly basic?