Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

code wars responsable drinker

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`;
}
Source by www.codewars.com #
 
PREVIOUS NEXT
Tagged: #code #wars #responsable #drinker
ADD COMMENT
Topic
Name
2+7 =