Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js reverse nested array

var reversed = array.map(function reverse(item) {
    return Array.isArray(item) && Array.isArray(item[0]) 
               ? item.map(reverse) 
               : item.reverse();
});
 
PREVIOUS NEXT
Tagged: #js #reverse #nested #array
ADD COMMENT
Topic
Name
2+4 =