@astrid@fedi.astrid.tech :char_nachoneko_baa: javascript
Conversation
Notices
-
Embed this notice
Puniko ? (puniko@mk.absturztau.be)'s status on Monday, 20-Mar-2023 16:43:16 JST Puniko ? -
Embed this notice
Puniko ? (puniko@mk.absturztau.be)'s status on Monday, 20-Mar-2023 16:49:11 JST Puniko ? @astrid@fedi.astrid.tech == checks for equal(ish) and === checks for reference. and this is the output of a test case in karma (a js unit testing framework) where i used .toBe instead of .toEqual
-
Embed this notice
malevolent dictator for life (astrid@fedi.astrid.tech)'s status on Monday, 20-Mar-2023 16:49:14 JST malevolent dictator for life @puniko oh, that makes sense (I think)
If you're checking with == then it's probably checking the references, like 2 different instances of lists aren't equal to each other. To check that their contents are equal, well, that's a bit more involved -
Embed this notice
niconiconi (niconiconi@mk.absturztau.be)'s status on Monday, 20-Mar-2023 17:02:20 JST niconiconi @puniko @astrid@fedi.astrid.tech JavaScript has a pretty loose interpretation of "equality", to the point that most linters generate warnings whenever you use "==" instead of "==="
Puniko ? likes this. -
Embed this notice
Puniko ? (puniko@mk.absturztau.be)'s status on Monday, 20-Mar-2023 17:04:58 JST Puniko ? @niconiconi @astrid@fedi.astrid.tech :char_nachoneko_baa: thats why i wrote "equal(ish)"[] == "" // true 0 == "0" // true [] == "0" // false
-
Embed this notice
Puniko ? (puniko@mk.absturztau.be)'s status on Monday, 20-Mar-2023 17:05:45 JST Puniko ? @niconiconi @astrid@fedi.astrid.tech
[] == 0 evaluates to true btw :char_nachoneko_baa:
-
Embed this notice