{"ScriptPreparationCode":"var array = [\r\n { id: \u00271\u0027, label: \u0027Bread\u0027, type: \u0027First\u0027 },\r\n { id: \u00272\u0027, label: \u0027Cola\u0027, type: \u0027First\u0027 },\r\n { id: \u00273\u0027, label: \u0027Apple\u0027, type: \u0027Second\u0027 },\r\n { id: \u00274\u0027, label: \u0027Apple\u0027, type: \u0027Second\u0027 },\r\n { id: \u00275\u0027, label: \u0027Avocado\u0027 },\r\n \t\t{ id: \u00271\u0027, label: \u0027Bread\u0027, type: \u0027First\u0027 },\r\n { id: \u00272\u0027, label: \u0027Cola\u0027, type: \u0027First\u0027 },\r\n { id: \u00273\u0027, label: \u0027Apple\u0027, type: \u0027Second\u0027 },\r\n { id: \u00274\u0027, label: \u0027Apple\u0027, type: \u0027Second\u0027 },\r\n { id: \u00275\u0027, label: \u0027Avocado\u0027 },\r\n \t\t{ id: \u002711\u0027, label: \u0027Bread\u0027, type: \u0027First\u0027 },\r\n { id: \u002712\u0027, label: \u0027Cola\u0027, type: \u0027First\u0027 },\r\n { id: \u002713\u0027, label: \u0027Apple\u0027, type: \u0027Second\u0027 },\r\n { id: \u002714\u0027, label: \u0027Apple\u0027, type: \u0027Second\u0027 },\r\n { id: \u002715\u0027, label: \u0027Avocado\u0027 },\r\n \t\t{ id: \u002721\u0027, label: \u0027Bread\u0027, type: \u0027First\u0027 },\r\n { id: \u002722\u0027, label: \u0027Cola\u0027, type: \u0027First\u0027 },\r\n { id: \u002723\u0027, label: \u0027Apple\u0027, type: \u0027Second\u0027 },\r\n { id: \u002724\u0027, label: \u0027Apple\u0027, type: \u0027Second\u0027 },\r\n { id: \u002725\u0027, label: \u0027Avocado\u0027 },\r\n \t\t{ id: \u002731\u0027, label: \u0027Bread\u0027, type: \u0027First\u0027 },\r\n { id: \u002742\u0027, label: \u0027Cola\u0027, type: \u0027First\u0027 },\r\n { id: \u002743\u0027, label: \u0027Apple\u0027, type: \u0027Second\u0027 },\r\n { id: \u002744\u0027, label: \u0027Apple\u0027, type: \u0027Second\u0027 },\r\n { id: \u002745\u0027, label: \u0027Avocado\u0027 },\r\n \t\t{ id: \u002741\u0027, label: \u0027Bread\u0027, type: \u0027First\u0027 },\r\n { id: \u002742\u0027, label: \u0027Cola\u0027, type: \u0027First\u0027 },\r\n { id: \u002743\u0027, label: \u0027Apple\u0027, type: \u0027Second\u0027 },\r\n { id: \u002744\u0027, label: \u0027Apple\u0027, type: \u0027Second\u0027 },\r\n { id: \u002745\u0027, label: \u0027Avocado\u0027 }\r\n ]","TestCases":[{"Name":"for","Code":"const groups = {};\r\nfor (var item = 0; i \u003C array.length; item\u002B\u002B) {\r\n const itemGroup = item[\u0027type\u0027] ?? \u0027notGrouped\u0027;\r\n\r\n if (!groups[itemGroup]) {\r\n groups[itemGroup] = [];\r\n }\r\n\r\n groups[itemGroup].push(item);\r\n}","IsDeferred":false},{"Name":"foreach","Code":"const groups = {};\r\narray.forEach(item =\u003E {\r\n const itemGroup = item[\u0027type\u0027] ?? \u0027notGrouped\u0027;\r\n\r\n if (!groups[itemGroup]) {\r\n groups[itemGroup] = [];\r\n }\r\n\r\n groups[itemGroup].push(item);\r\n});","IsDeferred":false},{"Name":"for..of","Code":"const groups = {};\r\nfor (var item of array) {\r\n const itemGroup = item[\u0027type\u0027] ?? \u0027notGrouped\u0027;\r\n\r\n if (!groups[itemGroup]) {\r\n groups[itemGroup] = [];\r\n }\r\n\r\n groups[itemGroup].push(item);\r\n}","IsDeferred":false}]}