You need to connect the array elements into a string with a certain character. The sample code is as follows:
var? First,? b,c; ?
Answer? =? New? Array (a, b, c, d, e); ?
b? =? a . join(“-); ? //a-b-c-d-e? Use-to splice array elements. =? a . join(“”); ? //abcde
Second, string to array.
The implementation method is to cut a string into several strings according to a certain character and return them in the form of an array. The sample code is as follows:
var? str? =? ‘a b+ c+de’; var? Answer? =? str . split('+'); ? //? 【ab,? c,? Germany]
var? b? =? str . split(“”); ? //[a,? b,? +,? c,? +,? d,? e]