1 00:00:00,350 --> 00:00:03,900 Arrow functions are less robust than function declarations. 2 00:00:03,900 --> 00:00:06,125 But they can't get even more concise. 3 00:00:06,125 --> 00:00:11,172 If your arrow function only takes a single argument like in 4 00:00:11,172 --> 00:00:16,326 the case of square and cube, you don't need parenthesis. 5 00:00:18,460 --> 00:00:22,105 You can't remove parenthesis on functions with no or 6 00:00:22,105 --> 00:00:26,770 multiple arguments, only on functions with singe arguments. 7 00:00:26,770 --> 00:00:31,380 If you're only using one line of code, you don't need the return keyword. 8 00:00:32,610 --> 00:00:35,660 It will always return the value of the statement 9 00:00:35,660 --> 00:00:38,200 without the use of the return keyword. 10 00:00:38,200 --> 00:00:42,880 You can reduce the arrow syntax further by removing the curly braces 11 00:00:42,880 --> 00:00:46,450 when you only have a single line of code in your arrow function. 12 00:00:48,330 --> 00:00:51,879 If you haven't got multiple lines of code in your function, 13 00:00:51,879 --> 00:00:55,300 this can really clean up the code to be more concise. 14 00:00:55,300 --> 00:01:01,412 Let's also make the cube function more concise by removing the parentheses, 15 00:01:01,412 --> 00:01:04,757 the return key word with the curly braces. 16 00:01:07,251 --> 00:01:10,394 Can we make the rest of these functions more concise? 17 00:01:12,982 --> 00:01:17,434 Multiply, add, and subtract are all one line long, so 18 00:01:17,434 --> 00:01:21,053 we can omit the returns and the curly braces. 19 00:01:32,043 --> 00:01:35,970 Since there are two arguments for each function, 20 00:01:35,970 --> 00:01:39,090 we have to leave the parentheses. 21 00:01:39,090 --> 00:01:41,936 Finally, let's take a look at functions with no arguments. 22 00:01:44,748 --> 00:01:46,800 Take a look at the sayName function. 23 00:01:47,920 --> 00:01:51,270 The sayName arrow function has two lines of code. 24 00:01:53,190 --> 00:01:55,370 So we can't reduce this further. 25 00:01:55,370 --> 00:02:00,420 Also there are no arguments, so we have to leave the parenthesis. 26 00:02:00,420 --> 00:02:05,418 The sayBye function can be reduced to a single line because there's only one 27 00:02:05,418 --> 00:02:07,769 line of code in the function block. 28 00:02:10,435 --> 00:02:11,690 And there you have it. 29 00:02:11,690 --> 00:02:15,635 We've refracted several function declarations into arrow function 30 00:02:15,635 --> 00:02:17,480 expressions. 31 00:02:17,480 --> 00:02:20,036 This shorter syntax can look strange at first. 32 00:02:21,970 --> 00:02:25,310 Take a look in the fourth and final file. 33 00:02:25,310 --> 00:02:31,230 Each one of these divide functions Are all functionally the same. 34 00:02:32,320 --> 00:02:38,369 The function declaration, The function expression, 35 00:02:38,369 --> 00:02:46,320 and then arrow functions perform the same task, dividing one number by another. 36 00:02:46,320 --> 00:02:50,230 I'd encourage you to get in additional practice by rewriting some of your 37 00:02:50,230 --> 00:02:55,330 own existing JavaScript programs to use the arrow function syntax. 38 00:02:55,330 --> 00:02:57,170 Most documentation, articles and 39 00:02:57,170 --> 00:03:01,490 courses about JavaScript use this new arrow function syntax. 40 00:03:01,490 --> 00:03:05,821 It's also expected of you as a JavaScript developer that you understand 41 00:03:05,821 --> 00:03:06,817 the syntax too. 42 00:03:06,817 --> 00:03:10,740 All modern browsers have support for the arrow function syntax. 43 00:03:10,740 --> 00:03:14,480 So it's never been a better time to start using it yourself. 44 00:03:14,480 --> 00:03:16,460 Until next time, keep coding.