- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript String Case
JavaScript Strings
JavaScript String Case
toUpperCaseandtoLowerCasereturn a new string in a different case.
Neither one changes the original, because strings cannot be changed.
The most common use is comparing text without caring about case.
Example
Example
javascript
const name = "Ada";
console.log(name.toUpperCase());
console.log(name);The original is untouched, as always with strings.
Changing Case
toUpperCase() returns an upper case copy.
toLowerCase() returns a lower case copy.
