У меня есть следующий объект JSON ниже.Какой эффективный способ считать смены и отделы таким образом, чтобы информация отображалась следующим образом:
shift 1: 10
shift 2: 15
shift 1 & Carton-Pack: 5
shift 1 & Picking: 3
etc.
Просто я новичок в javascript и боюсь, что могучрезмерно усложняющие вещи.
JSON Object
[
{"shift":2,"department":"Pallet-Pack"},
{"shift":1,"department":"Carton-Pack"},
{"shift":2,"department":"Carton-Pack"},
{"shift":1,"department":"Picking"},
{"shift":1,"department":"Carton-Pack"},
{"shift":1,"department":"Carton-Pack"},
{"shift":2,"department":"Picking"},
{"shift":3,"department":"Inventory"},
{"shift":1,"department":"Carton-Pack"},
{"shift":1,"department":"Receiving"},
{"shift":3,"department":"Equipment"},
{"shift":2,"department":"Receiving"},
{"shift":1,"department":"Picking"},
{"shift":1,"department":"Picking"},
{"shift":2,"department":"Carton-Pack"},
{"shift":2,"department":"Carton-Pack"},
{"shift":1,"department":"Receiving"},
{"shift":1,"department":"Returns"},
{"shift":1,"department":"Receiving"},
{"shift":1,"department":"Picking"},
{"shift":2,"department":"Receiving"},
{"shift":1,"department":"Pallet-Pack"},
{"shift":2,"department":"Picking"},
{"shift":1,"department":"Carton-Pack"}]