81
rated 0 times
[
86]
[
5]
/ answers: 1 / hits: 75830
/ 6 Years ago, mon, february 19, 2018, 12:00:00
What is the difference between spread operator
and array.concat()
let parts = ['four', 'five'];
let numbers = ['one', 'two', 'three'];
console.log([...numbers, ...parts]);
Array.concat()
function
let parts = ['four', 'five'];
let numbers = ['one', 'two', 'three'];
console.log(numbers.concat(parts));
Both results are same. So, what kind of scenarios we want to use them? And which one is best for performance?
More From » arrays