Junior Frontend Developer
My goal is to learn the technical stack for frontend development and learn how to develop websites and applications at a high level.
HTML5;CSS3;JavaScript (basics);Git;Github;Figma;Adobe Photoshop.Kata «Pete, the baker» from Codewars
Write a function cakes(), which takes the recipe (object) and the available ingredients (also an object) and returns the maximum number of cakes Pete can bake (integer). For simplicity there are no units for the amounts (e.g. 1 lb of flour or 200 g of sugar are simply 1 or 200). Ingredients that are not present in the objects, can be considered as 0.
function cakes(recipe, available) {
const result = [];
for (let item in recipe) {
if (item in available) {
const n = Math.floor(available[item] / recipe[item]);
result.push(n);
} else {
return 0;
}
}
return result.reduce((min, item) => (min < item) ? min : item);
}