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