+ 1

Guys why console.log(1+"1") produces 11 But console.log(11-"1") produces 10

24th Jan 2019, 7:38 PM
Sydney Chako 🇿🇼
Sydney Chako 🇿🇼 - avatar
4 odpowiedzi
+ 4
Mayb an error would have been less confusing. Thats what I think.
24th Jan 2019, 8:07 PM
Sydney Chako 🇿🇼
Sydney Chako 🇿🇼 - avatar
+ 1
Lexus Collins which means "1" is a string when adding but an int when subtracting. Maybe I missed that in the sololearn javascript tutorial.
24th Jan 2019, 8:03 PM
Sydney Chako 🇿🇼
Sydney Chako 🇿🇼 - avatar