This commit is contained in:
Philippe Torrel
2026-08-04 21:09:04 +02:00
parent 1afc687270
commit 07dfcec4ef
28 changed files with 6432 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
import { add, subtract } from './math';
console.log(add(1, 2)); // => 3;
console.log(subtract(3, 2)); //=> 1

View File

@@ -0,0 +1,13 @@
// explizite Freigabe von Einheiten
// math.js
export const add = (a, b) => a + b;
export const subtract = (a, b) => a - b;
// Übung 2: Mathfunktionen als Modul
// Programmiere zwei weitere Module, die jeweils eine Funktion multiply und divide enthalten. Importiere die Funktionen in der main.js-Datei und führe sie aus.
// Übung 3: Exportieren Funktionen als Objekt
// Anstatt die Funktionen add, subtract, multiply und divide benannt zu exportieren, exportiere sie als Standard-Export in einem Objekt. Importiere das Objekt in der main.js-Datei und führe die Funktionen aus.