Javascript
Javascript toLowerCase() - Convert Strings to Lowercase
📣 Sponsor
a String
is a type of data in Javascript, and as with any other type of data, String
s have prototypes and therefore inherit standard methods. One of these methods is toLowerCase()
, which you’ll often see written as String.prototype.toLowercase()
. This method turns any string from any case to just lowercase instead.
Here is a quick example:
let myString = 'HELLO WORLD'
console.log(myString.toLowerCase()) // hello world
This will work on anything which is of string type - so trying to initiate a new String()
and use this method also works:
let myString = new String('HELLO!')
console.log(myString.toLowerCase()) // hello!
Last Updated 1675543167736
More Tips and Tricks for Javascript
- How to check if a user has scrolled to the bottom of a page with vanilla Javascript
- Changing HTML Classes and Attributes in Javascript
- Instagram Style Video Preload Static Effect
- What are the three dots (...) or spread operator in Javascript?
- Javascript innerHTML
- Websockets Tutorial: Creating a real-time Websocket Server
- How to Change Node.js Version
- How JSON works in Javascript
- How to Create new Elements with Javascript
- How to fix 'Uncaught SyntaxError: Cannot use import statement outside a module'