📜  代码大战负责任的饮酒者 - C 编程语言代码示例

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

代码示例1
function hydrate(s) {
   let waterCount = s.split('').filter(e => e.match(/\d/)).reduce((acc, val) => +acc + +val, 0);
  return waterCount > 1 ? `${waterCount} glasses of water`: `${waterCount} glass of water`;
}