C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript Symbol.isConcatSpreadable PropertyThe JavaScript Symbol.isConcatSpreadable it is used to configure if an object should be flattened to its array elements. NOTE: This property spreads the array to its elements when used for concatenation.SyntaxArrayname[symbol.isConcatSpredable] = false ParametersNo parameters. Return valueConcatenation Result. Browser Support
Example 1<script> //JavaScript to illustrate Symbol.isConcatSpreadable //creating array for the concatenation var JavaTpoint = ['Core Java', 'RDBMS', 'C']; var A = ['Python', 'R', 'C++']; A[Symbol.isConcatSpreadable] = true; var Show = JavaTpoint.concat(A); document.write(Show); //expected output:Core Java,RDBMS,C,Python,R,C++ </script> Output: Core Java, RDBMS, C, Python, R, C++ Example 2<script> //JavaScript to illustrate Symbol.isConcatSpreadable //creating array for the concatenation var JavaTpoint = [1, 2, 3]; var A = [6,7,8]; A[Symbol.isConcatSpreadable] = true; var Show = JavaTpoint.concat(A); document.write(Show); //expected output:1,2,3,6,7,8 </script> Output: 1,2,3,6,7,8
Next TopicJavaScript Symbol
|