let a=10; let b=10; let c=10;
if(a==b==c)
console.log("Same");
}
else {
console.log("Not Same");
}
let a=10; let b=10; let c=10;
if(a==b==c)
console.log("Same");
}
else {
console.log("Not Same");
}
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jayraj ChhayaRank #304 · 8.2K reputationPosted Apr 4, 2024, 2:03 AM EDT
As above code answer is "Not same".
In the given code, the comparison
a==b==cmight not work as expected. JavaScript does not support chaining comparison operators like this.let a = 10; let b = 10; let c = 10; if (a === b && b === c) { console.log("Same"); } else { console.log("Not Same"); } //Output SameJithu ThomasRank #437 · 5.7K reputationPosted Apr 4, 2024, 2:39 AM EDT
let a = 10; let b = 10; let c = 10; if (a === b && b === c) { console.log("Same"); } else { console.log("Not Same"); }The correct form of usage. will give correct output.
Jignesh KumarRank #91 · 22.9K reputationPosted Apr 4, 2024, 5:54 AM EDT
You are missing {} braces in if condition.
It will log as "Not Same"