Bake a Cake explainer OLD


#1

The aim of this puzzle: Make a list (array) of ingredients (strings) needed to bake a cake.

Walkthrough of the solution: The cook() function is ready to turn ingredients into a cake but right now ingredients is just ‘flour’.

First, tap on the string ‘flour’ to highlight it. Next, tap the [] button to replace ‘flour’ with an empty array []. Now tap the str button to open the keyboard and type in the name of an ingredient like ‘sugar’ or ‘eggs’. Tap the empty space below the new ingredient you just entered and add another.

Once you have at least 2 strings inside the ingredients array, try running the code to bake your cake.

Sample code solution:
(Tap below to reveal)

var ingredients = [ 
    'flour', 
    'sugar', 
    'eggs', 
    'butter' 
];
cook(ingredients);

JavaScript Concepts: Data Structures (arrays), Variable Declaration, Calling Functions, Identifiers


#4

5 posts were merged into an existing topic: Bake a Cake explainer


#5

#6