Coding / Programming Videos

Post your favorite coding videos and share them with others!

Greetings Brandon – Stoz zy – Medium

Source link

Greetings Brandon

I know this is an ‘old’ article, but I came across it this morning and it helped with icing the cake with regards to spread operators. Is there a way use the spread operator to expand arrays with nested arrays?

A simple is example is:

let array1 = [2, 4, 5, 6, [8, 10], 12];

let array2 = […array1];

As I expected, the spread operator only expands on the parent array and outputs the child/nested array as is. Is there a way to use the spread operator in conjunction with another method that will alleviate this limitation?

Source link


Leave a Reply

Please Login to comment
Notify of
Translate »