Javascript - Easy way
Arrays Challenge
Source - https://scrimba.com/learn/introtojavascript/challenge-arrays-cwdd4qfz
// Challenge - Manage Inventory
/*
1. Your company is launching 3 new products: toilet paper, bottled water, and sanitizer. Store them in a list.
2. Turns out there was a mistake and toilet paper was actually paper towels. Make the appropriate update.
3. Sanitizer sells out. Remove it from the list.
4. Business is so good the company launches a new product: Bleach. Add it to the list.
*/
const products = ["toilet paper", "bottled water", "sanitizer"];
products[0] = "paper towels";
products.pop();
products.push("bleach");
console.log(products)
-----------------------------------------------------------------------------
[
"paper towels"
, "bottled water"
, "bleach"
]
Comments
Post a Comment