📜  计算数字中的重复数字 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:03:16.538000             🧑  作者: Mango

代码示例1
const createObjectFromNumber = (num) => {
  let object = {};
  while (num > 0) {
    let remains = Math.floor(num / 10);
    let temp = num - remains * 10;
    object[temp] = object[temp] ? object[temp] + 1 : 1;
    num = remains;
  }
  return object;
};