JS: String Operations
String length
console.assert("abc".length === 3);
Note: no parenthesis after βlengthβ.
String length of unicode string
if the string contains emoji, see:
Substring
console.assert("01234".slice(1, 3) === "12");
Index starts at 0.
Join String
Use the plus sign + to join strings.
console.assert(("aa" + "bb") === "aabb");
String Methods
JavaScript. String
- JS: String Overview
- JS: Quote String
- JS: Apostrophe Delimiter String
- JS: Template String
- JS: String Escape Sequence
- JS: Unicode Escape Sequence
- JS: String Operations
- JS: Iterate String
- JS: String Index Code Unit
- JS: Count Chars in String π
- JS: Tagged Template String
- JS: Regular Expression Functions
- JS: Convert String and Number
- JS: String (class)
- JS: String Constructor
- JS: String.prototype