This commit is contained in:
24
03_dom/projects/js-advanced-javascript-cafe-template-gkontra-main/.gitignore
vendored
Normal file
24
03_dom/projects/js-advanced-javascript-cafe-template-gkontra-main/.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
@@ -0,0 +1,23 @@
|
||||
## JavaScript Cafe
|
||||
|
||||
Willkommen beim JavaScript Cafe! Als Entwickler bist du verantwortlich für die Erstellung eines Moduls, das dem Cafe-Manager hilft, die Daten der Speisekarte effizient zu analysieren und zu verwalten. Die Speisekarte ist in verschiedene Kategorien unterteilt (z.B. Getränke, Gebäck), die jeweils mehrere Artikel mit spezifischen Details enthalten.
|
||||
|
||||
In dem Starter-Code ist ein mehrdimensionales Array, das die Speisekarte des Cafés darstellt. Jede Kategorie enthält mehrere Artikel, die jeweils mit einem Namen und einem Preis versehen sind.
|
||||
|
||||
**Die Aufgaben sind**
|
||||
|
||||
1. Liste alle Menüpunkte auf:
|
||||
|
||||
- Schreib eine rekursive Funktion <code>listMenuItems</code>, die das Array menu bekommt und ein flaches Array mit den Namen aller Einträge zurückgibt.
|
||||
|
||||
2. Eintragsdetails destrukturieren:
|
||||
|
||||
- Nutze die Destrukturierung innerhalb der Funktion <code>listMenuItems</code>, um den Namen und den Preis jedes Eintrags herauszuziehen.
|
||||
|
||||
3. Durchschnittlichen Preis berechnen:
|
||||
|
||||
- Nachdem du alle Menüeinträge aufgelistet hast, berechne den Durchschnittspreis für alle Einträge.
|
||||
|
||||
4. Artikel nach Kategorie suchen:
|
||||
|
||||
- Schreib eine Funktion <code>findItemsByCategory</code>, die das Menü-Array und einen Kategorienamen nimmt und ein Array mit allen Einträgen dieser Kategorie zurückgibt.
|
||||
@@ -0,0 +1,17 @@
|
||||
## License and terms of use
|
||||
|
||||
© Web Professional Institute Inc. All rights reserved.
|
||||
|
||||
This material is provided solely for students enrolled in courses offered by Web Professional Institute Inc. By accessing or using this code, you acknowledge that it is strictly for educational use within the context of Web Professional Institute Inc. programs.
|
||||
|
||||
**Usage Restrictions:**
|
||||
|
||||
- Redistribution, sharing, or copying of this material outside the course environment is strictly prohibited.
|
||||
- The content is designed to support your learning objectives and is not authorized for commercial projects, public repositories, or applications beyond the course scope.
|
||||
- Unauthorized commercial use or open-source distribution is strictly prohibited and may result in expulsion from the program and legal action.
|
||||
|
||||
**Agreement & Rights:**
|
||||
|
||||
As a student, you have agreed to these terms as part of your enrollment agreement, which includes additional details on permitted uses, restrictions, and policies. The author and Web Professional Institute Inc. retain all rights to this material, including the code base and instructional content.
|
||||
|
||||
For any questions regarding these terms, please contact Web Professional Institute Inc. for clarification.
|
||||
@@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
(() => {
|
||||
// === DOM & VARS =======
|
||||
const DOM = {};
|
||||
|
||||
// === DATA =============
|
||||
const menu = [
|
||||
{
|
||||
category: 'Beverages',
|
||||
items: [
|
||||
{ name: 'Coffee', price: 3.5 },
|
||||
{ name: 'Tea', price: 2.5 },
|
||||
{ name: 'Juice', price: 4 },
|
||||
],
|
||||
},
|
||||
{
|
||||
category: 'Pastries',
|
||||
items: [
|
||||
{ name: 'Croissant', price: 2.75 },
|
||||
{ name: 'Muffin', price: 2.5 },
|
||||
{ name: 'Bagel', price: 2.25 },
|
||||
],
|
||||
},
|
||||
{
|
||||
category: 'Sandwiches',
|
||||
items: [
|
||||
{ name: 'Ham Sandwich', price: 5.5 },
|
||||
{ name: 'Veggie Sandwich', price: 5 },
|
||||
{ name: 'Turkey Sandwich', price: 6 },
|
||||
],
|
||||
},
|
||||
];
|
||||
})();
|
||||
Reference in New Issue
Block a user