1 00:00:00,370 --> 00:00:03,920 Arrow functions are less verbose than function declarations. 2 00:00:03,920 --> 00:00:06,420 But they can get even more concise. 3 00:00:06,420 --> 00:00:10,850 If your arrow function only takes a single argument 4 00:00:10,850 --> 00:00:13,620 like in the case of square and cube. 5 00:00:14,640 --> 00:00:16,440 You don't need parentheses. 6 00:00:18,839 --> 00:00:23,840 You can't remove parentheses on functions with no or multiple arguments. 7 00:00:23,840 --> 00:00:26,800 Only on functions with single arguments. 8 00:00:26,800 --> 00:00:31,400 If you're only using one line of code, you don't need the return keyword. 9 00:00:32,630 --> 00:00:35,720 It will always return the value of the statement 10 00:00:35,720 --> 00:00:38,240 without the use of the return keyword. 11 00:00:38,240 --> 00:00:43,340 You can reduce the Arrow syntax further by removing the curly braces when you 12 00:00:43,340 --> 00:00:46,470 only have a single line of code in your array function. 13 00:00:48,350 --> 00:00:51,700 If you haven't got multiple lines of code in your function. 14 00:00:51,700 --> 00:00:55,400 This can really clean up your code to be more concise. 15 00:00:55,400 --> 00:01:00,060 Let's also make the cube function more concise by removing the parentheses, 16 00:01:01,780 --> 00:01:04,880 the return key word with the curly braces. 17 00:01:07,530 --> 00:01:10,490 Can we make the rest of these functions more concise? 18 00:01:12,909 --> 00:01:18,540 Multiply, add, and subtract are all one line long. 19 00:01:18,540 --> 00:01:21,159 So we can omit the returns and the curly braces. 20 00:01:31,970 --> 00:01:35,971 Since there are two arguments for each function, 21 00:01:35,971 --> 00:01:39,110 we have to leave the parentheses. 22 00:01:39,110 --> 00:01:42,130 Finally, let's take a look at functions with no arguments. 23 00:01:44,781 --> 00:01:47,541 Take a look at the same name function, 24 00:01:47,541 --> 00:01:51,180 the sayName are a function has two lines of code. 25 00:01:53,220 --> 00:01:55,400 So we can't reduce this further. 26 00:01:55,400 --> 00:01:57,910 Also there are no arguments. 27 00:01:57,910 --> 00:02:00,440 So we have to leave the parentheses. 28 00:02:00,440 --> 00:02:04,310 They say Bye function can be reduced to a single line. 29 00:02:04,310 --> 00:02:07,680 Because there's only one line of code in the function block. 30 00:02:10,750 --> 00:02:15,124 And there you have it, we've re-factored several function declarations into arrow 31 00:02:15,124 --> 00:02:17,500 function expressions. 32 00:02:17,500 --> 00:02:20,050 This shorthand syntax can look strange at first. 33 00:02:22,320 --> 00:02:25,340 Take a look in the fourth and final file. 34 00:02:25,340 --> 00:02:31,250 Each one of these divide functions Are all functionally the same. 35 00:02:32,340 --> 00:02:38,437 The function declaration, The function expression and 36 00:02:38,437 --> 00:02:43,600 the arrow functions perform the same task. 37 00:02:43,600 --> 00:02:46,370 Dividing one number by another. 38 00:02:46,370 --> 00:02:50,250 I'd encourage you to get in additional practice by rewriting some of your 39 00:02:50,250 --> 00:02:55,350 own existing JavaScript programs to use arrow function syntax. 40 00:02:55,350 --> 00:02:57,190 Most documentation, articles and 41 00:02:57,190 --> 00:03:01,510 courses about JavaScript use this new arrow function syntax. 42 00:03:01,510 --> 00:03:04,660 It's also expected of you as a JavaScript developer 43 00:03:04,660 --> 00:03:07,120 that you understand the syntax too. 44 00:03:07,120 --> 00:03:10,770 All modern browsers have support for the arrow function syntax. 45 00:03:10,770 --> 00:03:14,510 So it has never been a better time to start using it yourself. 46 00:03:14,510 --> 00:03:16,470 Until next time, keep coding.