Add another solution (#35644)
This commit is contained in:
		
				
					committed by
					
						
						The Coding Aviator
					
				
			
			
				
	
			
			
			
						parent
						
							739f4a8850
						
					
				
				
					commit
					ad5e844cb5
				
			@@ -148,6 +148,15 @@ You will definitely need recursion or another way to go beyond two level arrays
 | 
			
		||||
*   We replace the double comma with one, then split it back into an array.
 | 
			
		||||
*   map through the array and fix object values and convert string numbers to regular numbers.
 | 
			
		||||
 | 
			
		||||
##  Advanced Code Solution 2:
 | 
			
		||||
 | 
			
		||||
    const steamrollArray = arr => arr.flat(Infinity);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Code Explanation:
 | 
			
		||||
 | 
			
		||||
*   Use `Array.flat()` to flatten an array with `Infinity` as a parameter for the depth.
 | 
			
		||||
 | 
			
		||||
##  NOTES FOR CONTRIBUTIONS:
 | 
			
		||||
 | 
			
		||||
*    **DO NOT** add solutions that are similar to any existing solutions. If you think it is **_similar but better_**, then try to merge (or replace) the existing similar solution.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user