VOOZH about

URL: https://www.geeksforgeeks.org/javascript/javascript-symbol-isconcatspreadable-property/

⇱ JavaScript Symbol isConcatSpreadable Property - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

JavaScript Symbol isConcatSpreadable Property

Last Updated : 7 Aug, 2023

JavaScript Symbol.isConcatSpreadable is a well-known symbol used to configure if a given object should be flattened to its array elements while using the Array.prototype.concat() method.

Syntax:

Array[Symbol.isConcatSpreadable]

Here Array is the array object which is to be flattened to its array elements.

Parameters: This symbol does not accept any parameter.

Return value: This symbol does not return any value.

Example 1: In this example, we will use isConcatSpreadable Property


Output
[ 1, 2, 3, 4, 5, 6 ]
[ 1, 2, 3, [ 4, 5, 6, [Symbol(Symbol.isConcatSpreadable)]: false ] ]

Example 2: In this example, we will use isConcatSpreadable Property


Output
[ 1, 2, 3, 4, 5, 6 ]
[ 1, 2, 3, 4, 5, 6 ]

Supported Browsers:

  • Google Chrome 48 and above
  • Firefox 48 and above
  • Edge 15 and above
  • Opera 35 and above
  • Apple Safari 10 and above
Comment