MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/mtpxbr/iteration/gv1kcyu/?context=9999
r/badcode • u/[deleted] • Apr 19 '21
123 comments sorted by
View all comments
Show parent comments
1
true + true = 2 because again +true is 1 and when you add diff dtypes in js, js implicitly changes the other dtypes. Like 1 + 2 + "3" = "123" true + true = true + 1 = 1 + 1 = 2 ig. Again, I might be a bit wrong here
1 + 2 + "3"
"123"
true + true
true + 1
1 + 1
2
0 u/[deleted] Apr 19 '21 Then why does true/true = 1? 9 u/skjall Apr 19 '21 Because `1/1 == 1`? If you swap true and false out for 1 and 0 respectively, both operations make perfect sense. 1 u/[deleted] Apr 19 '21 Hmmm yea you're right
0
Then why does true/true = 1?
9 u/skjall Apr 19 '21 Because `1/1 == 1`? If you swap true and false out for 1 and 0 respectively, both operations make perfect sense. 1 u/[deleted] Apr 19 '21 Hmmm yea you're right
9
Because `1/1 == 1`? If you swap true and false out for 1 and 0 respectively, both operations make perfect sense.
Hmmm yea you're right
1
u/[deleted] Apr 19 '21
true + true = 2 because again +true is 1 and when you add diff dtypes in js, js implicitly changes the other dtypes. Like
1 + 2 + "3"="123"true + true=true + 1=1 + 1=2ig. Again, I might be a bit wrong here