bhylu.com

Advertisements

JS Strings

A string stores text. Its length counts UTF-16 code units, which is not always the number of visible characters.

Where to run this

This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.

A practical example

JavaScript

const title = "Repair club";
console.log(title.length);
console.log(title.toUpperCase());

What happens

The length is 11 and the uppercase text is REPAIR CLUB.