diff --git a/resources/docs/docs/chapters/tp/arrow-functions.md b/resources/docs/docs/chapters/tp/arrow-functions.md index 289d224ef1a6e68865435a3ac513009c287f811f..cd6fc6077954ff01e1ae5112b85f196c5af3f810 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