"$99.9" += 0
let str = "$99.9"
str += 0 // =>
that’s because you can only assign value to variable. In your case, you are trying to assign a value to a string. Litterally. The
+= operator translate to
variable = variable + 0. In your case it translate to this :
"$99.9" = "$99.9" + 0 and “$99.9” is not a variable nor a valid variable name.
In the second case, you are assigning the “$99.9” value to a variable THEN using the
+= operator to change the variable value.