0

Why was my answer marked wrong in challenge if your explanation was as stated below

Even if your strings contain numbers, they are still added as strings rather than integers. Adding a string to a number produces an error, as even though they might look similar, they are two different entities.

21st Oct 2017, 8:03 AM
aafrin
1 Antwort
+ 1
In most programming languages strings and numbers are completely different things. Example: "5" (a string) is not equal to 5 (a number) In most programming languages addition can be done only between numbers. Example: 4 + 7 = 11 (number + number = number) 4 + "7" = error (number + string = error)
16th Dec 2017, 11:20 PM
Augustinas Lukauskas
Augustinas Lukauskas - avatar