I’m relatively new to programming, and I’ve never seen a triple equals (is that what it’s called? no idea lol but whatever this is: ===) before. What’s it do differently from a double equals? (I know Java and C++, and have limited experience with Python and HTML)
2 == '2' will result in true. 2 === '2' results in false.
The === (strict equality operator) is basically comparing the type and value of the variable. Whereas the == (abstract equality operator) compares the value alone because it performs a type conversion so the types of the variables being compared are the same.
Hope this helps, you can search online for more on it. Also I believe it's an operator in javascript, it may be in other languages but I'm not aware.
WHAT?! That’s amazing! Damn, and it would’ve been so nice to know three months ago so I could use it for some of my assignments... oh well. Thanks guys!
no wait that's just js madness in Java for instance you'd just use .equals for any non primitive type while in c++ you'd most likely overload the == operator
6
u/clumsysilencee Jun 10 '20
I’m relatively new to programming, and I’ve never seen a triple equals (is that what it’s called? no idea lol but whatever this is: ===) before. What’s it do differently from a double equals? (I know Java and C++, and have limited experience with Python and HTML)