Hong-Phuc Bui
2025-10-17 85e9b6730a1c181d3c0d4a1a11ea3648dfac717c
review code update to ES arrow function
8 files modified
34 ■■■■■ changed files
textbased-programms/arithmetic-op.js 2 ●●● patch | view | raw | blame | history
textbased-programms/calendar.js 10 ●●●● patch | view | raw | blame | history
textbased-programms/dice-simulation.html 6 ●●●● patch | view | raw | blame | history
textbased-programms/dice-simulation.js 2 ●●● patch | view | raw | blame | history
textbased-programms/drawing-hands.html 3 ●●●● patch | view | raw | blame | history
textbased-programms/flipping-a-coin.html 4 ●●●● patch | view | raw | blame | history
textbased-programms/gravitation.html 5 ●●●● patch | view | raw | blame | history
textbased-programms/gravitation.js 2 ●●● patch | view | raw | blame | history
textbased-programms/arithmetic-op.js
@@ -11,5 +11,5 @@
    const b = 5;
    const c = Math.floor(a/b); // 2
    const d = (a/b) | 0;
    terminal.print(c);
    terminal.print(c, d);
};
textbased-programms/calendar.js
@@ -10,7 +10,7 @@
import {terminal} from "./dfhi.js";
let Calendar = {
const Calendar = {
    months: [undefined,
        "JAN", "FEB", "MÄR", "APR",
        "MAI", "JUN", "JUL", "AUG",
@@ -83,14 +83,14 @@
    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);
};
textbased-programms/dice-simulation.html
@@ -8,9 +8,9 @@
</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>
textbased-programms/dice-simulation.js
@@ -16,7 +16,7 @@
    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);
};
textbased-programms/drawing-hands.html
@@ -8,7 +8,8 @@
</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>
textbased-programms/flipping-a-coin.html
@@ -7,9 +7,9 @@
    <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>
textbased-programms/gravitation.html
@@ -8,8 +8,11 @@
</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>
textbased-programms/gravitation.js
@@ -17,5 +17,5 @@
    const mass2 = Number(argv[1]);
    const r = Number(argv[2]);
    const force = G * mass1 * mass2 / (r*r);
    terminal.printh(force);
    terminal.printh(`${force} N`);
};