This commit is contained in:
@@ -79,7 +79,7 @@ theme: default
|
||||
- Relationale Operatoren & Vergleichoperatoren
|
||||
- isNaN
|
||||
- Lexikographische Vergleiche
|
||||
- if else Verzweigung
|
||||
- if else Verzweigung und ternärer Operator
|
||||
- **Exkurs: HTML-Formularfelder**
|
||||
- 1:1 Meeting
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
# Todos
|
||||
|
||||
- [ ] Todo 1
|
||||
- [ ] Todo 2
|
||||
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
@@ -23,68 +23,68 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>'1.5' * 2</td>
|
||||
<td>-</td>
|
||||
<td>-</td>
|
||||
<td>3</td>
|
||||
<td>number</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>'1,5' * 2</td>
|
||||
<td>-</td>
|
||||
<td>-</td>
|
||||
<td>NaN</td>
|
||||
<td>number</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>'1.5' + 2</td>
|
||||
<td>-</td>
|
||||
<td>-</td>
|
||||
<td>'1.52'</td>
|
||||
<td>string</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Number('1.5') * 2</td>
|
||||
<td>-</td>
|
||||
<td>-</td>
|
||||
<td>3</td>
|
||||
<td>number</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Number('1,5') * 2</td>
|
||||
<td>-</td>
|
||||
<td>-</td>
|
||||
<td>NaN</td>
|
||||
<td>number</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Number('3 Tage') * 7</td>
|
||||
<td>-</td>
|
||||
<td>-</td>
|
||||
<td>NaN</td>
|
||||
<td>number</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Number('Seite 20') + 5</td>
|
||||
<td>-</td>
|
||||
<td>-</td>
|
||||
<td>NaN</td>
|
||||
<td>number</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>'9,2' + Number('11.7')</td>
|
||||
<td>-</td>
|
||||
<td>-</td>
|
||||
<td>'9,211.7'</td>
|
||||
<td>string</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>(NaN - 2) * (4 / 2)</td>
|
||||
<td>-</td>
|
||||
<td>-</td>
|
||||
<td>NaN</td>
|
||||
<td>number</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>alert(Number(17 / 2 + 1.3))</td>
|
||||
<td>-</td>
|
||||
<td>-</td>
|
||||
<td>undefined</td>
|
||||
<td>'undefined'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>console.log(Number(17 / 2 + 1.3))</td>
|
||||
<td>-</td>
|
||||
<td>-</td>
|
||||
<td>undefined</td>
|
||||
<td>'undefined'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>typeof 12.25</td>
|
||||
<td>-</td>
|
||||
<td>-</td>
|
||||
<td>'number'</td>
|
||||
<td>string</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>typeof typeof 12.25</td>
|
||||
<td>-</td>
|
||||
<td>-</td>
|
||||
<td>'string'</td>
|
||||
<td>string</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -92,6 +92,11 @@
|
||||
</main>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
// const result = alert('hello');
|
||||
// const result2 = console.log('Ergebnis: ', result);
|
||||
|
||||
// console.log(result, result2);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
@@ -42,9 +42,22 @@
|
||||
</main>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
//const tankGroesse = console.prompt('Wie groß ist Ihr Tank in liter?');
|
||||
const outputAEl = document.querySelector('.output-a');
|
||||
const outputBEl = document.querySelector('.output-b');
|
||||
|
||||
const streckeKm = Number(prompt('gefahrene Stecke in km'));
|
||||
const benzinL = Number(prompt('Benzinverbrauch in l'));
|
||||
const tankGroesse = Number(prompt('Tankgröße in l'));
|
||||
|
||||
const verbrauchkm = (benzinL / streckeKm) * 100;
|
||||
|
||||
////////////////
|
||||
|
||||
const maxReichweite = (tankGroesse * streckeKm) / benzinL;
|
||||
|
||||
outputAEl.textContent = `${verbrauchkm.toFixed(1)} l/100km.`;
|
||||
outputBEl.textContent = `Die maximale Reichweite beträgt ${Math.round(maxReichweite)}km`;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
@@ -22,6 +22,22 @@
|
||||
'use strict';
|
||||
|
||||
const outputEl = document.querySelector('.output');
|
||||
|
||||
// Wie viele Minuten und Restsekunden haben 2000 Sekunden? Verwende console.log für die Ausgabe.
|
||||
const minuten = 60;
|
||||
const gesamtSekunden = 2000;
|
||||
const sekProMinute = Math.round(gesamtSekunden / minuten);
|
||||
const restsekunden = Math.round(gesamtSekunden % 60);
|
||||
|
||||
console.log(sekProMinute);
|
||||
console.log(restsekunden);
|
||||
|
||||
const text = `2000 Sekunden sind ${sekProMinute} Minuten und ${restsekunden} Sekunden. ${sekProMinute}:${restsekunden} (mm:ss)`;
|
||||
|
||||
console.log(text);
|
||||
|
||||
outputEl.textContent = text;
|
||||
outputEl.innerHTML = text.replaceAll('\n', '');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -16,7 +16,7 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.lotto-number {
|
||||
.lotto-ball {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
@@ -28,7 +28,7 @@
|
||||
background: radial-gradient(circle, rgba(242, 242, 242, 1) 0%, rgba(130, 130, 130, 1) 93%);
|
||||
box-shadow: 0px 3px 10px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
.lotto-number span {
|
||||
.lotto-number {
|
||||
font-weight: bolder;
|
||||
}
|
||||
</style>
|
||||
@@ -36,7 +36,7 @@
|
||||
<body>
|
||||
<main>
|
||||
<div class="container py-5">
|
||||
<div class="alert alert-primary animate__animated animate__shakeY animate__infinite">
|
||||
<div class="alert alert-primary">
|
||||
<h2>Übung 18: Lotto oder der »49-Seiten Würfel«</h2>
|
||||
<p>
|
||||
Für Zufallszahlen von eins bis sechs ist ein Würfel wirklich praktisch — und sinnvoll. Für alle anderen
|
||||
@@ -58,6 +58,11 @@
|
||||
|
||||
const outputEl = document.querySelector('.output');
|
||||
const lottoNumberEl = document.querySelector('.lotto-number');
|
||||
|
||||
// Lottozahl ermitteln (von 1-49)
|
||||
const lottoNumber = Math.floor(Math.random() * 49) + 1;
|
||||
|
||||
lottoNumberEl.textContent = lottoNumber;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -36,6 +36,10 @@
|
||||
console.log(Math.PI); //=> 3.141592653589793
|
||||
|
||||
console.log(Math.max(3, 7, 20, 1)); // => 20
|
||||
|
||||
const numbers = [3, 7, 20, 1];
|
||||
console.log(Math.max(...[numbers])); // => 20
|
||||
|
||||
console.log(Math.min(3, 7, 20, 1)); // => 1
|
||||
|
||||
console.log(Math.abs(-3)); //=> 3
|
||||
|
||||
@@ -69,6 +69,13 @@
|
||||
|
||||
console.log('[' < '('); // => false
|
||||
|
||||
console.log('|' < ']'); // => false
|
||||
console.log('|'.charCodeAt() < ']'.charCodeAt());
|
||||
console.log(124 < 93);
|
||||
|
||||
console.log(']'.charCodeAt()); // => 93
|
||||
console.log('|'.charCodeAt()); // => 124
|
||||
|
||||
// implizite Typkonvertierung
|
||||
// Wenn ein Operand "Number" ist, dann wird gegenüberliegender Operand in "Number" konvertiert
|
||||
console.log('300' < 4); // => false (300 < 4)
|
||||
|
||||
Reference in New Issue
Block a user