javascript 传播运营商

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript 传播运营商相关的知识,希望对你有一定的参考价值。

// using the spread operator to combine arrays
var peaks = ["Tallac", "Ralston", "Rose"]
var canyons = ["Ward", "Blackwood"]
var tahoe = [...peaks, ...canyons]

console.log(tahoe.join(', '))   // Tallac, Ralston, Rose, Ward, Blackwood


// using the spread operator to copy and reverse an array without mutating the original
var peaks = ["Tallac", "Ralston", "Rose"]
var [last] = [...peaks].reverse()

console.log(last)   // Rose
console.log(peaks.join(', '))   // Tallac, Ralston, Rose


// using the spread operator to grab items from arrays
var lakes = ["Donner", "Marlette", "Fallen Leaf", "Cascade"]
var [first, ...rest] = lakes

console.log(rest.join(', '))    // Marlette, Fallen Leaf, Cascade


// using the spread operator to collect function arguments as an array
function directions(...args) {
  var [start, ...remaining] = args
  var [finish, ...stops] = remaining.reverse()
  
  console.log(`drive through ${args.length} towns`)
  console.log(`start in ${start}`)
  console.log(`the destination is ${finish}`)
  console.log(`stopping ${stops.length} times in between`)
}

directions(
  "Truckee",
  "Tahoe City",
  "Sunnyside",
  "Homewood",
  "Tahoma"
)


// the spread operator can also be used with objects
// the below example combines two objects
var morning = {
  breakfast: "oatmeal",
  lunch: "peanut butter and jelly"
}

var dinner = "mac and cheese"

var backpackingMeal = {
  ...morning,
  dinner
}

console.log(backpackingMeals)
// {breakfast: "oatmeal", lunch: "peanut butter and jelly", dinner: "mac and cheese"}

以上是关于javascript 传播运营商的主要内容,如果未能解决你的问题,请参考以下文章

javascript ......传播运营商

javascript 传播运营商

javascript 传播运营商

javascript 传播和休息运营商

新媒体运营需要什么能力?需要具备哪些运营技能?

不传播的原因是啥(es 6传播运算符)javascript错误对象[重复]