{"ScriptPreparationCode":"var products = {\r\n product1 : {Category: \u0027category1\u0027, Brand: \u0027brand1\u0027},\r\n product2 : {Category: \u0027category1\u0027, Brand: \u0027brand2\u0027},\r\n product3 : {Category: \u0027category2\u0027, Brand: \u0027brand3\u0027},\r\n product4 : {Category: \u0027category2\u0027, Brand: \u0027brand3\u0027}\r\n }\r\nfor(var i=5; i\u003C900; i\u002B\u002B) {\r\n (i%2==0) ? products[\u0027product\u0027\u002Bi] = {Category: \u0027category\u0027\u002B(i-1), Brand: \u0027brand\u0027\u002B(i-1)} : \r\n products[\u0027product\u0027\u002Bi] = {Category: \u0027category\u0027\u002Bi, Brand: \u0027brand\u0027\u002Bi};\r\n}\r\nvar uniqueCategoriesPresentAcrossProducts = new Set();\r\nvar level = \u0027Category\u0027;\r\nvar count = 0;","TestCases":[{"Name":"vanilla js foreach Iter using set","Code":"_.countBy(products, level);\r\nObject.keys(products).length","IsDeferred":false},{"Name":"lodash countBy","Code":"Object.keys(products).forEach(product =\u003E\r\n uniqueCategoriesPresentAcrossProducts.has(products[product][level]) ? null : uniqueCategoriesPresentAcrossProducts.add(products[product][level])\r\n );","IsDeferred":false}]}