Add Item
Part of the Fundamentals section of Coddy's JavaScript journey — lesson 72 of 77.
Challenge
EasyNow, add a function named addItem that gets a string (the item) and pushes it into the ingredients list.
In the end, the function will output:
Milk added to the grocery list.For the input "Milk".
Add the following code at the end of your code to test it:
addItem("Milk");
addItem("Bread");
addItem("Eggs");Try it yourself
// Grocery list array
let groceryList = [];All lessons in Fundamentals
4Operators Part 2
Logical Operators Part 1Logical Operators Part 2Recap - Simple LogicLogical Operators Part 3Type Coercion7Bill Split Calculator
Welcome MessageCalculating The Tip And Total2Variables
NumbersStringBooleanNaming ConventionsEmpty VariablesRecap - Initialize VariablesConstants3Operators Part 1
Arithmetic OperatorsModulo OperatorArithmetic ShortcutsComparison OperatorsStrict vs Loose EqualityRecap - Simple Math6Basic IO
OutputOutput with VariablesType Conversion - Part 1Type Conversion - Part 2Recap - Till 120Recap - True or False