Strings
Strings
In JavaScript, the textual data is stored as strings\. There is no separate type for a single character\.
The internal format for strings is always UTF\-16, it is not tied to the page encoding\.
$\{…\}\. - We can use special characters, such as a line break \\n\. - To get a character, use: \[\] or at method\. - To get a substring, use: slice or substring\. - To lowercase/uppercase a string, use: toLowerCase/toUpperCase\. - To look for a substring, use: indexOf, or includes/startsWith/endsWith for simple checks\. - To compare strings according to the language, use: localeCompare, otherwise they are compared by character codes\.str\.trim\(\) – removes \(“trims”\) spaces from the beginning and end of the string\. - str\.repeat\(n\) – repeats the string n times\. - …and more to be found in the manual\.Summary
Video