Or you could do the much more sane Perl&#x2F;Tcl thing and just have different pairs of operators for strings and numbers. Then the type of the variable is determined by what you&#x27;re doing to it, not by what you last did to it somewhere else and god knows whether or not your == will be transitive this time around.<p>$str1 . $str2 will always be treated as strings, even if both are numbers (I&#x27;ll get &quot;53&quot; not 8, if $str1 eq 5 and $str2 eq 3). $num1 + $num2 will either coerce them to numbers or fail, and I&#x27;ll never end up with &quot;5three&quot;.<p>Perl and Tcl might be debateably insane, but they make very sane choices when it comes to weak typing. Funny how a language where <i>literally everything is a friggin&#x27; string</i> has a more sane type system than JavaScript.