mirror of
				https://github.com/theoludwig/programming-challenges.git
				synced 2025-09-11 23:11:21 +02:00 
			
		
		
		
	
		
			
				
	
	
		
			13 lines
		
	
	
		
			281 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			13 lines
		
	
	
		
			281 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| function solution (folders, result = []) {
 | |
|   for (const folder of folders) {
 | |
|     if (folder.type === 'image') {
 | |
|       result.push(folder.name)
 | |
|     } else if (folder.type === 'folder') {
 | |
|       solution(folder.children, result)
 | |
|     }
 | |
|   }
 | |
|   return result
 | |
| }
 | |
| 
 | |
| module.exports = solution
 |