JavaScript-based quiz application called Quizz
I can understand your frustration of nested for loops.

However, your data structure is full of nested arrays. How else can you handle them?

One way to have pretty code is to separate each loop in its own function, with clear names.

This way, the main logic remains readable. And if you want to go in detail, the only scope you have to care about is a small function.

You can refactor more than in the example given above, it's all up to you.

Example:

var digest  = function() {      
        for( var q in qbank ) {
            //  q   is js/html/php/..... topic names    
            var
                topic,
                t,
                qns     = 0,
                i   = 0,
                questions,
                question,
                level
            ;

            topic   = qbank[q];

            initInstance( _instance, q );

            for( t in topic ) {
                initTopics( _instance, t, q );

            }
        }

        //  Initializing instance topics
        function initInstance( _instance, q ) {
            _instance.topics[q]= [];

            for( 
                var 
                    l = levels.length
                ; i &lt; l; i++ ) {

                if( typeof _instance.topics[q][i] === 'undefined' ) {
                    _instance.topics[q][i]  = {
                        'level': levels[i],
                        'questions': []
                    };
                }
            }
        }

        function initTopics( _instance, t, q ) {
            var
                questions   = topic[t].questions,
                level       = topic[t].level
            ;

            for( qns in questions ) {                   
                for( var 
                        inst = 0, 
                        l = _instance.topics[q].length; inst &lt; l; inst++ ) {

                    if( _instance.topics[q][inst].level === level ) {
                        _instance.topics[q][inst].questions.push( questions[qns] );
                    }
                }
            }
        }
};