Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
function calcSupply(age, maxAge, food, foodPerDay) {
    var days = (maxAge - age) * 365;
    var supply = days * foodPerDay;
    console.log(supply + "kg of "+ food + " would be enough until I am " + maxAge + " years old.");
}
calcSupply(38,118, "chocolate", 0.5);
calcSupply(20,87, "fruits", 2);
calcSupply(16,102, "nuts", 1.1);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers