数组转字符串&字符串转数组

xiaoxiao2021-02-28  29

let site = ['runoob', 'google', 'taobao','google'] //数组转字符串

let newSite = site.join('&') ;

//或者

let newSite = site.toString() ;

//检测数据类型 document.write(typeof(newSite)); //string //字符串转数组 let other = newSite.split("&") ; //检查数据类型 document.write(other instanceof Array);   //true
转载请注明原文地址: https://www.6miu.com/read-2630783.html

最新回复(0)