{"ScriptPreparationCode":"window.arr = [{\r\n\tkey : \u0027pier\u0027,\r\n\tobject : \u0027organization\u0027,\r\n\tpath : \u0027customAttributes\u0027,\r\n\tfullPath : \u0027customAttributes.pier\u0027,\r\n\tdataType : \u0027string\u0027,\r\n\tlabel : \u0027label\u0027,\r\n\tfilterable : false,\r\n\tsearchable : true,\r\n\tsortable : true,\r\n\twritable : true,\r\n\tcustom : true,\r\n\tarchived : false\r\n}, {\r\n\tkey : \u0027batang-pier\u0027,\r\n\tobject : \u0027organization\u0027,\r\n\tpath : \u0027customAttributes\u0027,\r\n\tfullPath : \u0027customAttributes.pier\u0027,\r\n\tdataType : \u0027string\u0027,\r\n\tlabel : \u0027label\u0027,\r\n\tfilterable : false,\r\n\tsearchable : true,\r\n\tsortable : true,\r\n\twritable : true,\r\n\tcustom : true,\r\n\tarchived : true\r\n}, {\r\n\tkey : \u0027global-port\u0027,\r\n\tobject : \u0027organization\u0027,\r\n\tpath : \u0027customAttributes\u0027,\r\n\tfullPath : \u0027customAttributes.pier\u0027,\r\n\tdataType : \u0027string\u0027,\r\n\tlabel : \u0027label\u0027,\r\n\tfilterable : false,\r\n\tsearchable : true,\r\n\tsortable : true,\r\n\twritable : true,\r\n\tcustom : true,\r\n\tarchived : false\r\n}]","TestCases":[{"Name":"Lodash","Code":"var result = _.reduce(arr, function(result, attribute) {\r\n if (!attribute.archived) {\r\n result[attribute.key] = attribute;\r\n }\r\n\r\n return result;\r\n}, {})\r\n\r\nconsole.log(result)","IsDeferred":false},{"Name":"Native","Code":"var result = arr.reduce(function(result, attribute) {\r\n if (!attribute.archived) {\r\n result[attribute.key] = attribute;\r\n }\r\n\r\n return result;\r\n}, {});\r\n\r\nconsole.log(result)","IsDeferred":false},{"Name":"For Loop","Code":"const result = {};\r\n\r\nfor (let i = 0; i \u003C arr.length; i\u002B\u002B) {\r\n\tconst attribute = arr[i];\r\n\r\n\tif (!attribute.archived) {\r\n\t\tresult[attribute.key] = attribute;\r\n\t}\r\n}\r\n\r\nconsole.log(result)","IsDeferred":false}]}