add examples for destructuring and try-catch-finally
Neue Datei |
| | |
| | | const o = { a: [0, {b: [0, 5]}, 2]};
|
| | |
|
| | | const { /* Destructuring-Ausdruck */ } = o;
|
| | |
|
| | | console.log(x);
|
Neue Datei |
| | |
| | | const o = { a: [0, {b: [0, { c: [{ x: 5 }, { d: 3}] }]}, 2]};
|
| | |
|
| | | const { /* Destructuring-Ausdruck */ } = o;
|
| | |
|
| | | console.log(x);
|
Neue Datei |
| | |
| | | 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);
|