Skip to content

JavaScript String method toLowerCase() and toUpperCase()

JavaScript provides two helpful functions for converting text to uppercase and lowercase.

  • String.toLowerCase() converts a string to lowercase
  • String.toUpperCase() converts a string to uppercase.
var text = 'Hello Poopcoder!';

// returns 'hello poopcoder!'
var lower = text.toLowerCase();

// returns 'HELLO POOPCODER!'
var upper = text.toUpperCase();

Both methods works in all modern browsers.

See also  How to get Current URL in JavaScript

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.