Posts

Showing posts from June, 2024
 // //interceptor // //npm package // //mfe  // interface parent{ //     name ?: string | Array<String> ; // } //rtk interface vs type // interface child extends parent{ //     age: number; // } // function Button(onClick ,type='fill'){ //  <button id="btn"  onClick={onClick}>Click</button> // } var a = [1,2,[3,[4,[5],6]],7,8,[9]]   //output:-  [1,2,3,4,5,6,7,8,9] const flatArray =(arr,res=[])=>{     for(let el of arr){         if(Array.isArray(el)){             flatArray(el,res)         }         else{             res.push(el)         }     }     return res; } const res= flatArray(a); console.log(res)