Difference between split and join in javaScript (detailed description), splitjoin
Common features: the split and join functions are usually operations on characters or strings;
Differences between the two:
(1) split () is used to split a string and return an array,
For example
Var string = "hello world? Name = xiaobai ";
Var splitString = string. split ("? ");
Console. log (splitString); // ["hello world", "name = xiaobai"]
Split () has only one parameter: The split string or regular expression. When two parameters are used, the second parameter indicates the number of elements in the returned array;
(2) join () is used to connect multiple characters or strings. the return value is a string;
For example
Var arr = new Array ();
Arr [0] = "hello ";
Arr [1] = "xiao ";
Arr [2] = "bai ";
Arr. join ("&"); // "hello & xiao & bai"
Join (); // The default Delimiter is comma;
The difference between split and join in the above javaScript section (detailed description) is all the content shared by the editor. I hope to give you a reference and support for the customer's house.