Javascript Map of Map solution
Follow the comments \n\nvar displayTable = function(orders) {\n    var mapOrders = {};\n    var tables = [];\n    var dishes = [];\n    for(var i=0;i<orders.len
Follow the comments \n```\nvar displayTable = function(orders) {\n    var mapOrders = {};\n    var tables = [];\n    var dishes = [];\n    for(var i=0;i<orders.length;i++){\n\t\t//if entry of table doesn\'t exist in mapOrders\n        if(mapOrders[orders[i][1]] == undefined){\n\t\t\t//conver table number to integer\n            var tableNo = Number(orders[i][1])\n            mapOrders[tableNo] = {}\n            mapOrders[tableNo][orders[i][2]] = 1;\n\t\t\t//if table number doesn\'t exist in table array, push it in the table array\n            if(!tables.includes(tableNo)){tables.push(tableNo)}\n\t\t\t//if dish doesn\'t exist in dishes array, push it in the dishes array\n            if(!dishes.includes(orders[i][2])){dishes.push(orders[i][2])}\n        }else{\n            //if entry of table exists in mapOrders\n            //conver table number to integer\n            var tableNo = Number(orders[i][1])\n            var entry = mapOrders[tableNo];\n            //check if entry of dish exists in for that table in mapOrders\n            if(entry[orders[i][2]] == undefined){\n                entry[orders[i][2]] = 1;\n            }else{\n                entry[orders[i][2]] = entry[orders[i][2]] + 1;\n            }\n            //if dish doesn\'t exist in dishes array, push it in the dishes array\n            if(!dishes.includes(orders[i][2])){dishes.push(orders[i][2])}\n        }\n    }\n    //sort tables and dishes\n    tables.sort(function(a,b){return a-b});\n    dishes.sort();\n    //append word "Table" with all dish names om row[0] of result\n    var res = [["Table"]];\n    for(var i=0;i<dishes.length;i++){\n        res[0].push(dishes[i]);\n    }\n    // read through map based on sorted table order\n    for(var i=0;i<tables.length;i++){\n        // append result in a temp array\n        var tmp = [];\n        //converting number to string using ""+\n        tmp.push(""+tables[i]);\n        for(var j=0;j<dishes.length;j++){\n            if(mapOrders[tables[i]][dishes[j]]==undefined){\n                //if dish doesn\'t exist against that table then append "0" to the result for that dish\n                tmp.push(""+0);\n            }else{\n                //if dish exists against that table then append value in mapOrders for that pair of (table,dish) to the result\n                tmp.push(""+mapOrders[tables[i]][dishes[j]]);\n            }\n        }\n        //append the temp array in result\n        res.push(tmp);\n    }\n    return res;\n};\n```
['JavaScript']