diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/653fb19b515fde28243f727a.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/653fb19b515fde28243f727a.md index e4136062380..a672dc4f2ab 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/653fb19b515fde28243f727a.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/653fb19b515fde28243f727a.md @@ -7,29 +7,22 @@ dashedName: step-11 # --description-- -Now you need a way to display the songs in the UI. To do this, you'll create a `renderSongs` function using the arrow function syntax. +Now you need a way to display the songs in the UI (User Interface). To do this, you'll create a `renderSongs` function using the arrow function syntax. -An arrow function is a shorter and more concise way to write functions in JavaScript. It's a function expression, which is a function that's assigned to a variable. To write an arrow function, you can use the following syntax: +An arrow function is a shorter and more concise way to write functions in JavaScript. It's a function expression, which is a function that's assigned to a variable. + +Here is an example of an arrow function with a single parameter and a single expression in the function body: ```js -// Traditional function -function add(a, b) { - return a + b; -} -console.log(add(3, 5)); // Output: 8 - -// Arrow function -const addArrow = (a, b) => { - return a + b; +const exampleArrowFunction = (param) => { + return param }; -console.log(addArrow(3, 5)); // Output: 8 ``` -If the function body consists of a single expression, you don't need the curly braces and the `return` keyword. This is called an `implicit return`: +If the function body consists of a single expression, you can omit the curly braces and the `return` keyword. This is called an `implicit return`: ```js -const addArrow = (a, b) => a + b; -console.log(addArrow(3, 5)); // Output: 8 +const exampleArrowFunction = (param) => param; ``` Use the arrow function syntax to create a `renderSongs` function that takes in `array` as its parameter.