Warning: Use of undefined constant hot - assumed 'hot' (this will throw an Error in a future version of PHP) in /data/wwwroot/lxy.me/wp-content/themes/Ality/inc/sticky-cat.php on line 5


Javascript中字符串和数组的互相转换

Javascript中字符串和数组的互相转换
一、字符串转数组 (用split方法将字符串按某个字符切割成若干个字符串,并以数组形式返回) var str = "1,2,3"; strArr = s.split(",");// 在每个逗号(,)处进行分解。 二、数组转字符串 (用join方法将数组元素用某个字符连接成字符串) var a = new Array(1,2,3); var b = a.join("-");