Code has been added to clipboard!

toLowerCase

Reading time 2 min
Published Sep 8, 2017
Updated Oct 2, 2019

JavaScript toLowerCase: Main Tips

  • This method is applied to convert all letters in a specified string in JavaScript lowercase.
  • The toLowerCase() method does not affect the original string. Instead, it generates a new modified string (with all lowercase letters).

toLowerCase() Method Explained

Even though JavaScript toLowerCase and toUpperCase perform opposite tasks, their functionality is very similar. For instance, they both retain digits and special symbols in the specified strings. Nevertheless, the JavaScript toLowerCase() function implements its task by replacing uppercase letters with lowercase ones.

Rather than modifying the letters in the original string, the JavaScript toLowerCase() creates a new changed string. Remember that the JavaScript lowercase function will decapitalize all letters in the string.

The example below shows how to properly use toLowerCase JavaScript function:

Example
var str = "Hi, Mark!";
var res = str.toLowerCase();

Tip: the toUpperCase() method can be used for converting letters to uppercase.

Learn Proper Syntax

There is nothing complicated about the way JavaScript toLowerCase method needs to be written. The method is simplified to the point that you do not have to worry about arguments that need to be included in the parentheses. Why? Because the function does not have any parameters.

However, you should remember the correct capitalization. The example code below shows the way lowercase JavaScript function should look in your code:

string.toLowerCase()

Other Technical Details: Return Value

The JavaScript toLowerCase() function will generate a clear return value. It will show a string in which all uppercase letters are converted to lowercase. As we have mentioned before, the string will be new, and the capitalization of the original one will stay as it was.

Return Value: A string, which represents the original string with the letters all converted to lowercase.
JavaScript Version: ECMAScript 1
What Is JavaScript Used For?
Tutorial
Introduction
Output
Syntax
Comment
Commands
Operators
Comparison and Logical Operators
Data Types
Math.random()
Type Conversion
Function Definitions
Events
Objects
Object Properties
Prototype
Array
Sorting Arrays
Strings
Numbers
Number Format
Math Object
Onclick Event
Date
Date Formats
Scope
Regular Expressions
Reserved Words
Common Mistakes
Performance
Forms
Form Validation
Window: The Browser Object Model
Popup Boxes
Cookies
JSON
AJAX Introduction
AJAX Form
Automatic File Download
Functions
Array Methods
String Methods
Date Methods
Timing Events
Cheat Sheet
JavaScript in HTML
HTML DOM Methods
HTML DOM Changing HTML
HTML DOM Animation
HTML DOM EventListener
HTML DOM Navigation
HTML DOM NodeList
HTML DOM Element Nodes
Array Functions
Boolean
Calling a Function
Date Functions
Global Objects
Input Text
Operator
Statements
String Functions
Math
Math.random
Number
RegEx
alert
array.filter
array.length
array.map
array.reduce
array.push
array.sort
break and continue
className
confirm
decodeURIComponent
for
forEach
if
indexOf
innerHTML
location.reload
number.toString
onclick
onload
parseInt
prompt
replace
setAttribute
setInterval
setTimeout
slice
splice
string.includes
string.indexOf
string.split
style.display
submit
substr
substring
switch
test
throw, try and catch
toLowerCase
toUpperCase
use strict
while
window.history
window.location
window.navigator
window.screen