In JavaScript, toLowerCase() is a string method that is used to convert a string to lowercase. Because the toLowerCase() method is a method of the String object, it must be invoked through a particular instance of the String class. Syntax In JavaScript, the syntax for the toLowerCase()...
Leave a comment... This textbox defaults to using Markdown to format your answer. You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link! Sign In or Sign Up to Comment ...
The function we passed to theArray.map()method gets called with each element in the array. On each iteration, we use thestr.toLowerCase()method to convert the current string to lowercase and return the result. Themap()method returns a new array containing the values returned from the call...
js:17:11 </anonymous> We got this error because str is not an string here. Check type before calling toLowerCase() method Check if the object on which you are calling toLowerCase() is String or not. Use console.log() to print it. It may be undefined sometimes. You can check if...
Tip This method works well on strings of 1 character or more. And it can be placed in a function for easier reuse. var animal = "cat"; // Uppercase first letter in a string. var uppercase = animal[0].toUpperCase() + animal.substring(1); console.log("RESULT: " + uppercase); RE...
toUpperCase() Method The toUpperCase() method transforms a string into uppercase letters in JavaScript. It doesn't change the original string and returns a new string equivalent to the string converted to uppercase. Here is an example: const str = 'JavaScript World!' // convert string to upp...
ThetoLowerCase()method does not change the original string. See Also: The toUpperCase() Method The toLocaleLowerCase() Method The toLocaleUpperCase() Method Syntax string.toLowerCase() Parameters NONE Return Value TypeDescription A stringThe string converted to lowercase. ...
[Microsoft.JScript.JSFunction(Microsoft.JScript.JSFunctionAttributeEnum.HasThisObject, Microsoft.JScript.JSBuiltin.String_toLowerCase)] public static string toLowerCase (object thisob); Parameters thisob Object The object that this method is acting upon. Returns String A lowercase string. Attributes...
To solve the error, make sure to only call thetoLowerCasemethod on strings. #Cannot read properties of null (reading 'toLowerCase') in JS The "Cannot read properties of null (reading 'toLowerCase')" error occurs when thetoLowerCase()method is called on a variable that stores anullvalue...
This method returns a copy of a string with the letters changed to lower case. Syntax stringVar.toLowerCase() Parameter Description Not applicable Returns A copy ofstringVarin lowercase characters. Usage This method returns a copy ofstringVarwith uppercase letters replaced by their lowercase equivalen...