6.5 Arrow Function
In the last video, you learned about this predicate function that we passed to the find method. In ES6, there is a shorter and simpler way to write the same code using arrow functions. So, whenever you want to pass a function, as a call back function or as an argument to a different method, you can use the arrow function syntax. Let's see how this works. So, you delete this function and separate the parameters of this function from its body with an arrow. That's what we call an arrow function. Now, if your function has only one parameter, we can also get rid of the parentheses, and that will make your code cleaner. If you have no parameters, you have to pass an empty parenthesis. In this case, we only have one parameter, so I'm going to put it here, and finally if your function Has one line of code and returns a value, we can make that code even shorter. You first get rid of the return keyword, and then you remove the braces, like this. And finally, you can put everything on one line. So here is the final result. Course.name = 'a'. That's it for this video on the arrow function, we will see in the next video deleting elements in an array.