Quick actions

cmd+k|ctrl+k

Navigation

Languages

Challenge: Patatas bravas

Snippet info

Language

JavaScript

Visibility

public

Author

noemi-techfems

Created

2024-09-06T19:12:18.739861Z

Updated

2024-09-06T19:12:27.677644Z

// Here's the explanation of the challenge -- when you're done reading it,
// click on `main.js` above to get started with the challenge!

// It's time to make some _patatas bravas_ for our bar! But we just got a new
// batch of potatoes in, and we're not sure how many portions we can make
// using those potatoes. We'll figure this out with code!

// ## Description

// In this challenge, you will write a `makeBravas` function that receives a
// list (array) as an argument. Each element of the list is a string
// containing the word `"small"`, `"medium"` or `"large"`, representing a
// potato of that size.

// For example, if there is one large potato, one small potato and two medium
// potatoes, your function could be invoked like:

// makeBravas(["medium", "large", "small", "medium"])

// Your function should return the amount of complete portions of
// _patatas bravas_ that can be made with the given potatoes. Here's all you
// need to know about making _bravas_, the "secret recipe", if you will:

// A **small** potato can only be chopped into **four** potato chips.
// A **medium** potato can be chopped into **eight** potato chips.
// A **large** potato can be chopped into **twenty-four** potato chips!
// To make a **portion** of _patatas bravas_, you need **twenty** potato chips.

// Any potato chips that remain after the complete portions are made are
// discarded. For example, given one large potato, your function should return
// exactly one (`1`), as you can only make one portion -- the four leftover
// chips are ignored.
INFO