String manipulation in JS
String: The base data type, once defined, is not modified, and if modified, re-opens the space store. Strings have attribute length and a series of methods.
The generation transformation of a string (any type of data can be converted to a string)
Three ways to convert to a string:
1.. toString () method
Note: Undefined, NULL does not have the ToString () method.
Code
var num = 28;
Console.log (typeof num.tostring ());
The returned result is "string",
2. String () method
Note: Undefiend, NULL can be converted to strings by string ()
3. (A + "") stitching string
Note: All types can be converted into strings by stitching the string
Find characters by index:
1. Str.charat (index value); Result: the character of the corresponding index in the string
Compatibility: Good
Code:
var str = ' 0123ABC Hello! ‘;
Record String manipulation in JavaScript