var str = "I learn JavaScript";
alert( str.toUpperCase() +"\n" + str );
// ⇑ Show returned string, and original variable on second line
var str = "I learn JavaScript";
str = str.toUpperCase(); // Original string now capitalized!
alert( str );
.capitalized {
text-transform:uppercase;
}
<input type="text" name="twoLetterState"
style="text-transform:uppercase"
onchange="this.value=this.value.toUpperCase()"
>
$twoLetterState = strtoupper( $twoLetterState );
Sister / opposite method: use toLowerCase() to get a copy of a string converted to minuscules.