Menu
Coddy logo textTech

Recap - Bicycle Shop

Part of the Logic & Flow section of Coddy's JavaScript journey — lesson 26 of 65.

challenge icon

Challenge

Easy

Create a function named updateBikeInventory that takes one argument, a JSON string inventoryStr.

Parse it into an object, where inventoryStr has a bikes array. Each bike has brand, price, and quantity.

If a bike's quantity is less than 3, add or update a key note with the value "Restock needed" for that bike.

Return the updated object as a JSON string.

Try it yourself

function updateBikeInventory(inventoryStr) {
    // Write code here
}
// Don't write anything outside the function

All lessons in Logic & Flow