Javascript - String Case Methods

Introduction

Four methods perform case conversion:

  • toLowerCase(),
  • toLocaleLowerCase(),
  • toUpperCase(), and
  • toLocaleUpperCase().

The toLowerCase() and toUpperCase() methods return new string value and change its case.

The toLocaleLowerCase() and toLocaleUpperCase() methods are based on a particular locale.

Demo

var stringValue = "hello world";
console.log(stringValue.toLocaleUpperCase());  //"HELLO WORLD"
console.log(stringValue.toUpperCase());        //"HELLO WORLD"
console.log(stringValue.toLocaleLowerCase());  //"hello world"
console.log(stringValue.toLowerCase());        //"hello world"

Result