{"version":"1.0","type":"rich","title":"Flatten","description":"This example demonstrates how a recursive array-flattening function reduces nested arrays of varying depth into a single flat sequence. The code defines a `flatten` function using `Array.reduce` and `Array.concat`, testing it against three increasingly nested inputs—`basic`, `medium`, and `hardCore`—and verifying each result equals `[1,2,3,4,5,6]` with Node’s `assert.deepEqual`. It shows the algorithm’s ability to handle arbitrarily deep nesting by recursively invoking itself on sub-arrays, producing the same output regardless of input complexity. No visualization libraries are used; the example is pure JavaScript logic executed in a runtime environment.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-7509ba5adb96cfbd790a0d372ef0ba22?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}