代碼會(huì)說(shuō)話:
ES35合并數(shù)組
{
? ? var params=[‘hello’,true,7];
? ? var other=[1,2].concat(params);
? ? console.log(other);//1,2,’hello’,true,7
}
ES6合并數(shù)組
{
? ? var params=[‘hello’,true,7];
? ? var other=[1,2,…params];
? ? console.log(other)//1,2,’hello’,true,7
}
整理以自鑒 不喜請(qǐng)補(bǔ)充~ 嗯嘛