Javascript toLowerCase() – Convert Strings to Lowercase

a String is a type of data in Javascript, and as with any other type of data, Strings have prototypes and therefore inherit standard methods. One of these methods is toLowerCase(), which you’ll often see written as String.prototype.toLowercase(). This …


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Johnny Simpson

a String is a type of data in Javascript, and as with any other type of data, Strings 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!


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Johnny Simpson


Print Share Comment Cite Upload Translate Updates
APA

Johnny Simpson | Sciencx (2023-02-04T23:11:12+00:00) Javascript toLowerCase() – Convert Strings to Lowercase. Retrieved from https://www.scien.cx/2023/02/04/javascript-tolowercase-convert-strings-to-lowercase/

MLA
" » Javascript toLowerCase() – Convert Strings to Lowercase." Johnny Simpson | Sciencx - Saturday February 4, 2023, https://www.scien.cx/2023/02/04/javascript-tolowercase-convert-strings-to-lowercase/
HARVARD
Johnny Simpson | Sciencx Saturday February 4, 2023 » Javascript toLowerCase() – Convert Strings to Lowercase., viewed ,<https://www.scien.cx/2023/02/04/javascript-tolowercase-convert-strings-to-lowercase/>
VANCOUVER
Johnny Simpson | Sciencx - » Javascript toLowerCase() – Convert Strings to Lowercase. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/02/04/javascript-tolowercase-convert-strings-to-lowercase/
CHICAGO
" » Javascript toLowerCase() – Convert Strings to Lowercase." Johnny Simpson | Sciencx - Accessed . https://www.scien.cx/2023/02/04/javascript-tolowercase-convert-strings-to-lowercase/
IEEE
" » Javascript toLowerCase() – Convert Strings to Lowercase." Johnny Simpson | Sciencx [Online]. Available: https://www.scien.cx/2023/02/04/javascript-tolowercase-convert-strings-to-lowercase/. [Accessed: ]
rf:citation
» Javascript toLowerCase() – Convert Strings to Lowercase | Johnny Simpson | Sciencx | https://www.scien.cx/2023/02/04/javascript-tolowercase-convert-strings-to-lowercase/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.