This commit is contained in:
Philippe Torrel
2026-09-23 10:47:07 +02:00
parent b16dd8458d
commit 082a9bd7b3
11 changed files with 209 additions and 18 deletions
@@ -27,9 +27,9 @@
const convertCsvToObj = (csv = '') => {
const rows = csv.split('\n'); // => ['name, category, price', 'Klingon Letter Opener, Office Warfare, 19.99',...]
const headerRow = rows.shift().split(/\s*,\s*/);
const headerFields = rows.shift().split(/\s*,\s*/);
console.log(headerRow); // => ['name', 'category', 'price']
console.log(headerFields); // => ['name', 'category', 'price']
const productRows = rows
.map((row) => row.trim()) // "white spaces" der Strings werden entfernt
@@ -60,7 +60,8 @@
const products = convertCsvToObj(productsCsv);
// output
console.log(products);
console.log(JSON.stringify(products, null, 2)); // JSON String
console.log(products); // Produkte Array
outputEl.innerHTML = `<ol>${products
.map((product) => {
@@ -30,7 +30,7 @@
const calcFactorialWithWhile = () => {};
// Test cases
console.log(calcFactorial(5)); // => 120
console.log(calcFactorial(5)); // => 5! = 5 * 4 * 3 * 2 * 1 = 120
console.log(calcFactorial(3)); // => 6
console.log(calcFactorial(0)); // => 1