Skip to content
Advertisement

Get smallest string out of the array with nested arrays

I am trying to get the smallest string out of every nested array in the following array object

JavaScript

I have tried the code but it gives me stackoverflow error,Any help please

JavaScript

Required result -Smallest in every array (nested one as well)

JavaScript

Advertisement

Answer

You could take a recursive approach.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement