scrimba
Javascript Hacks with ES6-ES7
Javascript Hack with ES6-ES7 #28
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Javascript Hack with ES6-ES7 #28
AboutCommentsNotes
Javascript Hack with ES6-ES7 #28
Expand for more info
index.js
run
preview
console
const numbers = [1, 2, 3]
const otherNumbers = [4, 5, 6]
const numbersConcatenated = numbers.concat(otherNumbers)
console.log(numbersConcatenated) // [1, 2, 3, 4, 5, 6]
// You can merge as many arrays as you want
function concatAll(arr, ...arrays) {
return arr.concat(...arrays)
}
console.log(concatAll([1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]))


// [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
Console
"Hello from JavaScript"
,
index.html
-1:32