⊗jsPmBsSL 30 of 504 menu

String length in JavaScript

The number of characters in a string is contained in the property length:

let str = 'abcde'; alert(str.length); // shows 5

The length property can be applied directly to a string:

alert('abcde'.length); // shows 5

Space is also a character:

alert('ab de'.length); // shows 5

Write a string to a variable. Print the length of your string to the screen.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline