Symbol.isConcatSpreadable JavaScript

The JavaScript Symbol.isConcatSpreadable property determines if an object should be flattened to its array elements or not.

Syntax:

Array_name[symbol.isConcatSpredable] = true/false 

Returns:
Symbol corresponding to a specific key.

Example 1:

<!DOCTYPE html>
<html>
<body>
<script>
var alpha = ['X', 'Y', 'Z'];
var beta = ['A', 'B', 'C'];
beta[Symbol.isConcatSpreadable] = true;
var Display = alpha.concat(beta);
document.write(Display);
</script>
</body>
</html>

Example 2:

<!DOCTYPE html>
<html>
<body>
<script>
const alpha = ['d', 'e'];
const numeric = [15, 52];
let alphaNumeric = alpha.concat(numeric);
document.write(alphaNumeric);
document.write("</br>");
numeric[Symbol.isConcatSpreadable] = true;
alphaNumeric = alpha.concat(numeric);
document.write(alphaNumeric);
</script>
</body>
</html>