How can I loop into two arrays and create string output from both arrays statArr and typeArr with appending some AND & OR operators?
What I am hoping to get at the output is
stat = 'Closed' AND type = 'RD' OR
stat = 'Closed' AND type = 'WW' OR
stat = 'Closed' AND type = 'CC' OR
stat = 'Closed' AND type = 'MB' OR
stat = 'Closed' AND type = 'CN' OR
stat = 'Investigation' AND type = 'RD' OR
stat = 'Investigation' AND type = 'WW' OR
stat = 'Investigation' AND type = 'CC' OR
stat = 'Investigation' AND type = 'MB' OR
stat = 'Investigation' AND type = 'CN'
var statArr = ["Closed", "Investigation"];
var typeArr = ["RD", "WW", "CC", "MB", "CN" ];
var sql = "";
for (let i = 0; i < statArr.length; i++) {
sql += "stat = " + statArr[i] + " AND Type =";
}
console.log(sql);
stat = 'Closed' AND type = 'RD' OR stat = 'Closed' AND type = 'WW' OR stat = 'Closed' AND type = 'CC' OR stat = 'Closed' AND type = 'MB' OR stat = 'Closed' AND type = 'CN' OR stat = 'Investigation' AND type = 'RD' OR stat = 'Investigation' AND type = 'WW' OR stat = 'Investigation' AND type = 'CC' OR stat = 'Investigation' AND type = 'MB' OR stat = 'Investigation' AND type = 'CN'