This commit is contained in:
Philippe Torrel
2026-08-18 14:27:34 +02:00
parent c7d26e1cd9
commit c6d9611e81
35 changed files with 1852 additions and 130 deletions

View File

@@ -0,0 +1,25 @@
<!doctype html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Divide</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" />
</head>
<body>
<main>
<div class="container py-5">
<h1>Divide</h1>
</div>
</main>
<script>
'use strict';
function divide(a) {
return a / b;
}
console.log(divide(10));
</script>
</body>
</html>

View File

@@ -0,0 +1,5 @@
function divide(a, b) {
return a / b;
}
console.log(divide(10));

View File

@@ -0,0 +1,33 @@
<!doctype html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Extraction sum</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" />
</head>
<body>
<main>
<div class="container py-5">
<h1>Extraction sum</h1>
</div>
</main>
<script>
'use strict';
const products = [
{ name: 'Product1', price: 10.5 },
{ name: 'Product1', price: 10.5 },
];
// Extraction
const sum = (a, b) => {
return Number(a) + Number(b);
};
const totals = products.map((product) => Number(product.price));
const totalPrice = totals.reduce(sum, 0);
console.log(`total: ${totalPrice}`);
</script>
</body>
</html>