🐰 Easy solution || 🥕Short & Simple || 🥕
\n\n# Code\n\n/**\n * @param {any[]} arr\n * @param {number} depth\n * @return {any[]}\n */\nvar flat = function (arr, n) {\n    const ans =[]\n    const traver
\n\n# Code\n```\n/**\n * @param {any[]} arr\n * @param {number} depth\n * @return {any[]}\n */\nvar flat = function (arr, n) {\n    const ans =[]\n    const traverse=(ele,i)=>{\n        if(i > n || !Array.isArray(ele))return ans.push(ele)\n        ele.forEach(e=>traverse(e ,i + 1))\n    }\n    traverse(arr,0)\n    return ans \n};\n```
['JavaScript']