String Escape Sequence
String is a Primitive Value
String is Immutable
In practice, this means, if you need to create a long string, such as repeatedly append to a string one thousand times, you should not use a loop with append to do that. Because, the process of creating a long string is expensive. (The workaround in this case is to use a array. Push string to the array, then use Array.prototype.join to convert it to string.)
String is 16 Bits Unit Sequence
Each “character” in string is a 16 bits unit, not a “character”. String index is counting these units, not character. This is critical when the string contains Unicode character such as emoji 😃, where such character takes 2 indexes.
[see Character, Code Unit, Codepoint]
String value can also be created by using the constructor function
[see String Constructor]
String is Iterable
That means, you can use for-of Loop and it will go thru the string by char, not 16bits units.
you can also use Spread Operator to turn a string into a array of chars.
- String Overview
- Quote String
- Template String
- String Escape Sequence
- Unicode Escape Sequence
- String Operators/Function/Methods
- Iterate Thru String
- String Code Unit
- Tagged Template String
- Regex Functions
- Convert String/Number