I am using JavaScript and I want to check equality of the variable values within if condition. It can check equality of two variables but I don't know how to do it with multiple variables. I like to express it as follows but it wrong. Is there a way to check this?
var a = 2, b = 2, c = 2, d = 2, e = 2, f = 1; if(a == b == c == d == e == f){ console.log("All values are equel"); }else{ console.log("Values are not equel"); }
if (a === b && a === c && ...)if (yourArray.every(function(v) { return v === yourArray[0]; }))