1 00:00:00,370 --> 00:00:05,060 Arrow functions are a common way you'll see anonymous functions being written. 2 00:00:05,060 --> 00:00:10,120 In this video, we'll convert our anonymous functions into arrow functions. 3 00:00:10,120 --> 00:00:14,030 Let's pull out this anonymous function from the executeCallback function. 4 00:00:15,380 --> 00:00:19,050 This way, we can see the progression from a regular anonymous function 5 00:00:19,050 --> 00:00:20,970 to an arrow function. 6 00:00:20,970 --> 00:00:24,003 To convert a function into an arrow function, 7 00:00:24,003 --> 00:00:26,505 simply remove the function keyword. 8 00:00:26,505 --> 00:00:31,492 And after the parentheses, add an equal sign and a greater than symbol, 9 00:00:31,492 --> 00:00:34,390 this is often called a fat arrow. 10 00:00:34,390 --> 00:00:41,095 Let's reintroduce the callback into the executeCallback function. 11 00:00:41,095 --> 00:00:46,720 Arrow functions have an even shorter syntax, if there's a single line of code, 12 00:00:46,720 --> 00:00:52,060 you can remove the curly braces, like so. 13 00:00:52,060 --> 00:00:55,424 Why not pause the video and create an arrow function for 14 00:00:55,424 --> 00:00:57,557 the goodbye anonymous callback? 15 00:01:01,528 --> 00:01:06,338 How did you do, it's pretty straightforward, 16 00:01:06,338 --> 00:01:10,688 remove the keyword, and add the fat arrow. 17 00:01:10,688 --> 00:01:17,528 You could have gone a step forward and removed the curly braces too, 18 00:01:17,528 --> 00:01:22,720 you'd also need to remove the semicolon. 19 00:01:22,720 --> 00:01:26,610 You need to remove the semicolon after the console.log statement, 20 00:01:26,610 --> 00:01:31,560 because it would terminate the line of code before the last parentheses. 21 00:01:31,560 --> 00:01:34,870 If the line of code terminated before the parentheses, 22 00:01:34,870 --> 00:01:38,580 the executeCallback function wouldn't get executed. 23 00:01:40,450 --> 00:01:44,755 Well done, you've created your own callback function and callback executor, 24 00:01:44,755 --> 00:01:47,840 and used two styles of anonymous functions. 25 00:01:47,840 --> 00:01:51,420 So far, the example we have used is pretty contrived. 26 00:01:51,420 --> 00:01:55,210 In the next few sections, we're going to take a look at some real world examples 27 00:01:55,210 --> 00:01:57,800 using timers and a document object model.