/

HTML / CSS / JavaScript Tutorial

JavaScript String method: toLocaleUpperCase()

[this page | pdf | back links]

The toLocaleUpperCase() method (when applied to a JavaScript string) returns a string that is the original string converted to lower case characters, bearing in mind the language settings of the browser (so sometimes does not return the same as toUpperCase).

 

It has the following syntax (with no parameters):

 

string.toLocaleUpperCase()

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head>
<style>
table,th,tr,td {border: 1px solid black; border-collapse: collapse;}
</style>
</head>
<body>
<table>
<tr>
<th>Example</th>
<th>Resulting value of <code>x</code></th>
</tr>
<tr>
<td><code id="Example"></code></td>
<td><code id="Result"></code></td>
</tr>
</table>

<script>
var q = "aBcD";
document.getElementById("Example").innerHTML =
  'var q = "' + q + '";<br>' +
  'var x = q.toLocaleUpperCase();';
document.getElementById("Result").innerHTML =
  q.toLocaleUpperCase();
</script>

</body>
</html>

FUNCTION THAT MAY ASSIST IN TESTING WHETHER FEATURE IS SUPPORTED:
function isSupportedJavaScriptMethodStringToLocaleUpperCase() {
  var z = "abc"; return !!z.toLocaleUpperCase;
}


NAVIGATION LINKS
Contents | Prev | Next | JavaScript String Variables


Desktop view | Switch to Mobile