Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

use recursation in iife in js

(function printItems(items) {
    if (!items) {
        return;
    }

    for (var i = 0; i < items.length; i++) {
        var item = items[i];
        console.log(item.name + ' - ' + item.value);
        printItems(item.items);
    }
})(data);
Source by www.codementor.io #
 
PREVIOUS NEXT
Tagged: #recursation #iife #js
ADD COMMENT
Topic
Name
5+6 =