This commit is contained in:
56
01_grundlagen/unterricht/tag03/01_numbers.html
Normal file
56
01_grundlagen/unterricht/tag03/01_numbers.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Numbers</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" />
|
||||
<style>
|
||||
h1 {
|
||||
color: #ff9900; /* rgb(255, 153, 0) */
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div class="container py-5">
|
||||
<h1>Numbers</h1>
|
||||
<video src="https://i.imgur.com/FKwTYak.mp4" controls></video>
|
||||
</div>
|
||||
</main>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
// Binär (0b = Binary)
|
||||
let binaryExample = 0b1101; //=> 13
|
||||
|
||||
// Oktal (0o = Octal)
|
||||
let octalExample = 0o17; //=> 15, 7 * (8^0) + 1 * (8^1) = 15
|
||||
let octalExample2 = 0o223; // = 147, da (3 * 1) + (2 * 8) + (2 * 64)
|
||||
|
||||
// Hexadezimal (0x = Hex)
|
||||
let hexExample = 0xff; //=> 255, da 15 * (16^0) + 15 * (16^1)
|
||||
// 15 + 240
|
||||
// 0 - 9 A - F
|
||||
|
||||
// Exponential (z.B. 123e5 = 12300000)
|
||||
let exponentialExample = 123e5; // 12300000
|
||||
console.log(exponentialExample);
|
||||
|
||||
console.log('Binär:', binaryExample, typeof binaryExample); // 13 , 'number'
|
||||
console.log('Oktal:', octalExample, typeof octalExample); // 15 , 'number'
|
||||
console.log('Hexadezimal:', hexExample, typeof hexExample); // 255 , 'number'
|
||||
console.log('Exponential:', exponentialExample, typeof exponentialExample); // 123000 , 'number'
|
||||
|
||||
// BigInt (2020) vs. Number
|
||||
let bigNumber = 1234567890123456n;
|
||||
|
||||
let normalNumber = Number.MAX_SAFE_INTEGER; // => 9007199254740991 - Maximale sichere Zahl (Number): 2^53
|
||||
console.log('Max Number: ', normalNumber);
|
||||
console.log(typeof bigNumber); // 'bigint'
|
||||
|
||||
// Gleitkommazahlen-Präzision
|
||||
console.log('0.1 + 0.2 =', 0.1 + 0.2); // 0.30000000000000004
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user