I have JavaScript code. My if statement is not working as I hope it to do so. Inside of my for loop I have 2 if statements. The issue is that when using 2 if statements my alert function is not working. If I remove either the first or the second if statement where I only have 1 if statement the alert function work. I need to check for both condition
does not work
const getDbData = (selections) =>{
// db select query goes here
(sqlTx, res) => {
console.log('Midi map check [Scenes] completed successfully');
let len = res.rows.length;
// Check for items here
if (len > 0) {
let sceneAssignedResults = false;
let groupAssignedResults = false;
for (let i = 0; i < len; i++) {
let item = res.rows.item(i);
// remove this if or the next if then everything works
if (item.type === 'scene') {
sceneAssignedResults = true;
}
if (item.type === 'scene' && selections.item.type !== 'scene') {
groupAssignedResults = true;
}
}
alert(`${sceneAssignedResults} ${groupAssignedResults}`);
}
}
}