You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**[⬆ Back to Top](#javascript-coding-challenges-for-beginners)**
1563
+
1564
+
## 47. Pete, the baker
1565
+
1566
+
Pete likes to bake some cakes. He has some recipes and ingredients. Unfortunately he is not good in maths. Can you help him to find out, how many cakes he could bake considering his recipes?
1567
+
1568
+
Write a function `cakes()`, which takes the `recipe` object and the `available` ingredients object and returns the maximum number of cakes Pete can bake. Ingredients that are not present in the objects, can be considered as `0`.
1569
+
1570
+
```js
1571
+
constcakes= (recipe, available) => {
1572
+
// Your solution
1573
+
};
1574
+
1575
+
let recipe = { flour:500, sugar:200, eggs:1 };
1576
+
let available = { flour:1200, sugar:1200, eggs:5, milk:200 };
0 commit comments