Code
Loading editor...
Tap Analyze to see visualization
Click Analyze to visualize
See step-by-step execution, variables, and output
Variables
Run code to see variables
Output
Console output will appear here
Click Analyze to visualize
See step-by-step execution, variables, and output
Run code to see variables
Console output will appear here
Create a new result array, copy all elements from the original array, then iterate through each argument. If an argument is an array, spread its elements individually into the result; if it is a scalar value, push it directly. This produces a new array without mutating the originals.
Concat produces a shallow copy that merges arrays and values into a single flat array. It only flattens one level of array arguments, leaving nested arrays intact.
Updated Feb 2026