review code update to ES arrow function
| | |
| | | const b = 5; |
| | | const c = Math.floor(a/b); // 2 |
| | | const d = (a/b) | 0; |
| | | terminal.print(c); |
| | | terminal.print(c, d); |
| | | }; |
| | |
| | | |
| | | import {terminal} from "./dfhi.js"; |
| | | |
| | | let Calendar = { |
| | | const Calendar = { |
| | | months: [undefined, |
| | | "JAN", "FEB", "MÄR", "APR", |
| | | "MAI", "JUN", "JUL", "AUG", |
| | |
| | | return leapYear; |
| | | } |
| | | |
| | | window.main = function(...argv) { |
| | | let month = Number.parseInt(argv[0]); |
| | | let year = Number.parseInt( argv[1] || 2021 ); |
| | | window.main = (...argv) => { |
| | | const month = Number.parseInt(argv[0]); |
| | | const year = Number.parseInt( argv[1] || 2021 ); |
| | | |
| | | Calendar.month = month; |
| | | Calendar.year = year; |
| | | |
| | | let cal = Calendar.showCalendar(); |
| | | const cal = Calendar.showCalendar(); |
| | | terminal.printh(cal); |
| | | }; |
| | | |
| | |
| | | </head> |
| | | <body> |
| | | |
| | | <p class="description">Simulation eines Würfel</p> |
| | | <label for="run">Klicken Sie auf „Run“ um eine Zahl zu würfeln</label> |
| | | <button name="run" id="run" >Run</button> |
| | | <p class="description">Simulation eines Würfels</p> |
| | | <label for="run">Roll the dice</label> |
| | | <button name="run" id="run" >Roll</button> |
| | | |
| | | |
| | | <pre id="text-output"></pre> |
| | |
| | | |
| | | let face = Math.floor(Math.random() * (max - min + 1) + min ); |
| | | let path = `${IMG_DIR}/${face}.png`; |
| | | let img = `<img width="20px" src="${path}" />`; |
| | | let img = `<img width="50px" src="${path}" />`; |
| | | terminal.clear(); |
| | | terminal.printh(img); |
| | | }; |
| | |
| | | </head> |
| | | <body> |
| | | |
| | | Gegenseitige Auruf <input type="text" id="argv" name="argv" /> |
| | | <p class="description">Funktionen, die sich gegenseitig aufrufen</p> |
| | | |
| | | <button name="run" id="run" >Rerun</button> |
| | | |
| | | |
| | |
| | | <link rel="stylesheet" href="dfhi.css" /> |
| | | </head> |
| | | <body> |
| | | <p class="description">Flip A Coin</p> |
| | | |
| | | <code>main</code>'s arguments: <input type="text" id="argv" name="argv" /> |
| | | <button name="run" id="run" >Rerun</button> |
| | | <button name="run" id="run" >Flip</button> |
| | | |
| | | |
| | | <pre id="text-output"></pre> |
| | |
| | | </head> |
| | | <body> |
| | | |
| | | <button name="run" id="run" >Rerun</button> |
| | | <p class="description">Programm zum Berechnen der Gravitationskraft zwischen 2 Masse</p> |
| | | |
| | | <label for="argv">Geben Sie das Gewicht von 2 Massen (in Kg) und die Distanz (in meter) ein!</label> |
| | | <input type="text" id="argv" name="argv" /> |
| | | <button name="run" id="run" >Rerun</button> |
| | | |
| | | <pre id="text-output"></pre> |
| | | <script type="module" src="gravitation.js"></script> |
| | |
| | | const mass2 = Number(argv[1]); |
| | | const r = Number(argv[2]); |
| | | const force = G * mass1 * mass2 / (r*r); |
| | | terminal.printh(force); |
| | | terminal.printh(`${force} N`); |
| | | }; |