js数组转字符串,字符串转数组

一、数组转字符串(将数组元素用某个字符连接成字符串)

var a, b;

a = new Array(0,1,2,3,4);

b = a.join("-");

 

二、字符串转数组(将字符串按某个字符切割成若干个字符串,并以数组形式返回)

var s = "abc,abcd,aaa";

ss = s.split(",");// 在每个逗号(,)处进行分解。

本文永久地址:https://sjolzy.cn/js-array-to-a-string-array-of-strings-turn.html

--EOF--

随机文章

已有 3 条评论

  1. 不错,很好的js基础知识!!!

  2. Hot sales vibram five fingers shoes for men and women, you can buy cheap shoes of classic vibram, kso, bikila, sprint and flow vibram in our online five fingers store.

  3. 小J小J

    呵呵,基础不扎实,看来要好好看基础

添加新评论