Numbers, Strings and Coercion

Terminology

Coercion
Implicitly converting a value from one type to another.
Arithmetic operator
Arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value.
Addition Operator (+)
The addition operator produces the sum of numeric operands OR string concatenation.
String Concatenation
Joining two or more strings together.

Untyped languages and coercion

It's important to know that Javascript is an untyped language, meaning that a variable will often be converted from one data type (such as a number) to another (a string). This often "helps" programmers type less code but will sometimes cause problems when you don't expect it.

Key Takeaways