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

Popular posts from this blog

(gradle-2.13-all)-Exception in thread "main" java.lang.RuntimeException: java.io.IOException: Server returned HTTP response code: 403 for URL: http://services.gradle.org/distributions/gradle-2.13-all.zip

LetsLearn JavaScript

Cordova App for Publishing to an App Store - Steps by Steps (https://docs.microsoft.com/)