JavaScript Casing
The ES5 spec defined two methods for changing the case of a string, .toUpperCase()
and .toLowerCase()
. They work just like Ruby's upcase
and downcase
.
'test'.toUpperCase()
=> "TEST"
'TEST'.toLowerCase()
=> "test"
There are two similar methods called .toLocaleUpperCase()
and .toLocaleLowerCase()
which are intended to yield the correct result based on the host environment's locale. I have not seen these methods in the wild but I'm curious if they are used.