js数组如何转化为字符串,特定符号转化字符串

js数组如何转化为字符串

1、使用 toString 方法。例:文章来源地址https://www.yii666.com/learning/js/91.html文章地址https://www.yii666.com/learning/js/91.html

var arr = ['a','b','c','d']
var str = arr.toString();
console.log(str);
//输出:a,b,c,d
console.log(typeof str);
//输出:string

2、使用 join 方法。例:网址:yii666.com<

var a = ['a','b','c','d']
arr.join(",")
console.log(arr);
//输出:a,b,c,d
console.log(typeof s);
//输出:string


网址:yii666.com文章来源地址:https://www.yii666.com/learning/js/91.html

其他相关文章
    领支付宝红包赞助服务器费用
    如何防止 PHP 中的 SQL 注入?
    微信公众号:小猪波罗蜜
    关注公众号,回复999,可联系站长解答疑问哦。每天分享更多有趣的事儿,有趣有料!
    99人已关注

    觉得文章有用就打赏一下文章作者

    支付宝扫一扫打赏

    微信图片_20190322181744_03.jpg

    微信扫一扫打赏

    请作者喝杯咖啡吧~

    支付宝扫一扫领取红包,优惠每天领

    二维码1

    zhifubaohongbao.png

    二维码2

    zhifubaohongbao2.png