What does calling concat with no parameters do in JavaScript

javascript, syntax

Solution

Concat function is used for concatenation of two Arrays in javascript.

For Example:

a = [1,2,3]
b = [4,5]

a = a.concat(b); // a becomes [1,2,3,4,5]

Edit

Using `concat` with no arguments can be used to copy an array. For example:

var a = [1,2,3];
var b = a.concat();
b.push(4);

// a is [1,2,3] and b is [1,2,3,4]

Read this from MDN concat source

concat does not alter this or any of the arrays provided as arguments but instead returns a shallow copy that contains copies of the same elements combined from the original arrays. Elements of the original arrays are copied into the new array

Problem

What is the point/result of calling `concat` with no parameters? E.g. Code: ``` var board = [ false, false, false, false, false, false, false, false ]; board = board.concat(); ```

Original source