Array concat method in JavaScript

Array concat is a method and an array property for concating one array onto another to archive merging of array elements.

Syntax for array concat;

const arr = [0,1,2,3]
const arrr = [4,5]
// [0,1,2,3,4,5]

Merging nested arrays using spread operator.
It's possible to merge nested arrays to form a uniform array.

Take for instance you have two 2-dimensional arrays,
Or let's call them matrices

const arr2d = [[1,0],[0,1]]
// [0,1]]
const arrr2d = [[1,1],[0,1]]
// [0,1]]

For instance you want to reduce the two 2-dimentional arrays and create a new array instance;

// [1, 0, 0, 1, 1, 1, 0, 1]


Popular posts from this blog

What is 'this.' keyword in JavaScript

How to make a static http server in nodejs using express

Ways of iterating Object properties in JavaScript

How to get user's ip address in JavaScript