This document contains a hint for the Restaurant Ordering App solo project.
PS: Please remember that we have both a #javascript-help channel and a #html-css-help channel in our Discord community. If you have a very specific issue you’re struggling with, you should consider posting it there.
JavaScript hints
- You can use an array method to iterate over the data and create HTML string for each menu item.
- You can use a
data-attribute
to link a button to a menu item. - When an item is added to an order, you will need to push its object to an array of orders and iterate over that array to generate html string.
- To remove an order, you will need to figure out the index of that menu item’s object in the array of orders.
- ⚠️ The strict equality operator (
===
) will return false unless you are comparing the same data types. For example:console.log(1 === ‘1’) // false
The first 1 is a number, the second ‘1’ (with inverted commas) is a string. You can check a data type usingtypeof
and then google how to change, say, astring
to anumber
or vice versa if necessary!
If you are still struggling for hours with this Solo Project after having used the above hints, please let the teacher Tom Chant know via the #general channel on Discord, and we will consider adding more hints. Important: be sure to include a link to your scrim, so that he can understand what you are struggling with.