If you just make sure to always use === then this is exactly what happens. You can use tools like jslint to warn you if you accidentally use ==
The error in this case would be forgetting Javascript's rules of implicit conversion.
Adding a float to a string results in a string.