From 6ebbe7e0acd8756b4a9546952bbc049f4c3f1c47 Mon Sep 17 00:00:00 2001 From: oabdelnour <oabdelnour@takima.fr> Date: Mon, 26 Feb 2024 16:40:13 +0100 Subject: [PATCH] wip --- .../docs/docs/chapters/tp/arrow-functions.md | 78 ++++++++----------- 1 file changed, 34 insertions(+), 44 deletions(-) diff --git a/resources/docs/docs/chapters/tp/arrow-functions.md b/resources/docs/docs/chapters/tp/arrow-functions.md index 289d224..cd6fc60 100644 --- a/resources/docs/docs/chapters/tp/arrow-functions.md +++ b/resources/docs/docs/chapters/tp/arrow-functions.md @@ -76,14 +76,36 @@ Waiting a certain amount of time can be easily done using the [`setTimeout()`](h <details><summary> Show the game.js file </summary> - === "game.js - with function" - - ``` js - export class GameComponent { - goToScore() { - // ... - setTimeout( - function () { + === "game.js - with function" + + ``` js + export class GameComponent { + goToScore() { + // ... + setTimeout( + function () { + const scorePage = "#score"; + scorePage + + "?name=" + + this._name + + "&size=" + + this._size + + "&time=" + + timeElapsedInSeconds; + }.bind(this), + 750 + ); + } + } + ``` + + === "game.js - with arrow function" + + ``` js + export class GameComponent { + goToScore() { + // ... + setTimeout(() => { const scorePage = "#score"; scorePage + "?name=" + @@ -92,44 +114,12 @@ Waiting a certain amount of time can be easily done using the [`setTimeout()`](h this._size + "&time=" + timeElapsedInSeconds; - }.bind(this), - 750 - ); - } - } - ``` - - === "game.js - with arrow function" - - ``` js - export class GameComponent { - goToScore() { - // ... - setTimeout(() => { - const scorePage = "#score"; - scorePage + - "?name=" + - this._name + - "&size=" + - this._size + - "&time=" + - timeElapsedInSeconds; - }, 750); + }, 750); + } } - } - ``` - </details> + ``` -:::tabbed -@A - ```js - console.log("coucou"); - ``` -@B -```js - console.log("coucou"); - ``` -::: + </details> ## Template literals -- GitLab