this is a very peculiar curiosity that I'm not apparently able to benchmark with significant results.
The following code blocks perform the same simple comparison, they differ only in the order that I use inside the condition:
Code1:
const val = true;
if (val === true) {
console.log('this is a truism');
}
Code2:
const val = true;
if (true === val) {
console.log('this is a truism');
}
- Is there any performance difference?
- Is one implementation better than the other for any reason?
Thank you guys! đ
Aucun commentaire:
Enregistrer un commentaire