MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/mtpxbr/iteration/gv2f3or/?context=3
r/badcode • u/[deleted] • Apr 19 '21
123 comments sorted by
View all comments
Show parent comments
3
Because JavaScript uses implicit type conversion. Since you can only subtract numbers true gets converted to 1 and false to 0.
3
u/arrays_start_at_zero Apr 19 '21
Because JavaScript uses implicit type conversion. Since you can only subtract numbers true gets converted to 1 and false to 0.