If I have something like:
let x = 20;
var z = 20;
will
x === z
===
does not compare variables - it does compare values. Given that both your variables hold the same value (20
), they will be "equal".
It does not matter for the equality how those variables were declared, only that both of them are in scope and have that value assigned when the ===
operation is evaluated. Which is the case in your example snippet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With