📅  最后修改于: 2022-03-11 15:01:26.641000             🧑  作者: Mango
// create object from array
const createObjectFromArray = (arr) => {
let obj = {};
for (let value of arr) {
obj[value] = ++obj[value] || 1;
}
return obj;
};