Skip to main content

字符串转为数组

使用split()方法

使用split()方法,可以将给定字符串str拆分为字符串数组,语法“str.split(separator)”,separator指定分割的地方

使用Array.from()方法

使用Array.from()方法,字符串的每个字母都转换为新数组实例的元素

链接

js将字符串转为数组有哪些实现方法