// 展开操作符
var fruits =[
'apple',
'balan',
'organize']
var number = [
1,
2,
9];
console.log(fruits); // ['apple','balan','organize']
console.log(...fruits);
// apple balan organize
var hello = [
'hi',...number]
console.log(hello) // ["hi", 1, 2, 9]
//剩余操作符
function breakfase (desert,drink,...foods){
console.log(desert) // hi
console.log(drink)
// hello
console.log(foods)
// ["ye", "good", "nihao"]
};
breakfase('hi',
'hello',
'ye',
'good',
'nihao')
转载请注明原文地址: https://mac.8miu.com/read-509131.html