loading...

Discussion on: Daily Challenge #83 - Deodorant Evaporator

Collapse
bhuvan profile image
Bhuvan Ganesan

Javascript version

const evaporator = (content, evapPerDay, threshold) => {
  let  outOfUseDays = 0, percentage = 100;  
  while (percentage > threshold) {
    percentage = percentage - percentage * (evapPerDay / 100);
    outOfUseDays += 1;
  }
  return outOfUseDays;
}
//console.log('evaporator --> ',evaporator('ml',7,2));