var arr = ['Car', 'Car', 'Truck', 'Boat', 'Truck'];var hist = {};hist = arr.reduce((prev, item) => { if (item in prev) { prev[item]++ } else { prev[item] = 1 } return prev;}, {});