Sascha Schulz
2023-06-06 a06ab8e309a5b498c1e95f3788f1e85db7a34a3d
add examples for destructuring and try-catch-finally
3 Dateien hinzugefügt
29 ■■■■■ Geänderte Dateien
templates/007-js/destructuring-1.js 5 ●●●●● Patch | Ansicht | Raw | Blame | Historie
templates/007-js/destructuring-2.js 5 ●●●●● Patch | Ansicht | Raw | Blame | Historie
templates/007-js/try-catch-finally.js 19 ●●●●● Patch | Ansicht | Raw | Blame | Historie
templates/007-js/destructuring-1.js
Neue Datei
@@ -0,0 +1,5 @@
const o = { a: [0, {b: [0, 5]}, 2]};
const  { /* Destructuring-Ausdruck */ } = o;
console.log(x);
templates/007-js/destructuring-2.js
Neue Datei
@@ -0,0 +1,5 @@
const o = { a: [0, {b: [0, { c: [{ x: 5 }, { d: 3}] }]}, 2]};
const  { /* Destructuring-Ausdruck */ } = o;
console.log(x);
templates/007-js/try-catch-finally.js
Neue Datei
@@ -0,0 +1,19 @@
function throwError() {
    try {
        throw new Error("Fehler!");
        return "Hello World!";
    }
    catch(e) {
        return e.message;
    }
    finally {
        console.log("Finally wird immer ausgeführt");
        return "Finally hat Vorrang!";
    }
}
const result = throwError();
console.log(result);