怎麼來的|
當我打電話join方法的Javascript分裂,推動和參與
var array ="12|23|435|566|46|6|666766|24";
var arraySplit = array.split("|");
var newArray = [];
for (i=0; i<arraySplit.length; i++)
{
if (arraySplit[i] < 500)
{
newArray.push(arraySplit[i]);
}
}
newArray.join("|");
alert(newArray);
看看MDN的文檔:https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/join –