Take Your Arrays and Spread 'em #programming #javascript #coding #howtostartcodingforbeginners

preview_player
Показать описание
more es6 stuff that you might not know
Рекомендации по теме
Комментарии
Автор

Join the Discord if you're interested in actually learning how to code! No courses, no begging for money, just looking to share the joys of software!

jacksonsingleton
Автор

In this example the spread operator works, but remember the spread operator clones the object, therefore if the original arrays change this would not be included within your spreaded list.

const foo = [1, 2]
const bar = [3, 4]
const foobar = [foo, bar]
const spread = […foo, …bar]
console.log(foobar.flat())
console.log(spread)
bar.push(5)
console.log(foobar.flat())
console.log(spread)

Axlology
welcome to shbcf.ru