1 00:00:00,420 --> 00:00:02,043 I challenge you to try and 2 00:00:02,043 --> 00:00:05,915 use an anonymous function with the setInterval function. 3 00:00:05,915 --> 00:00:10,355 And to think if it's possible to use one with our clock application. 4 00:00:10,355 --> 00:00:15,854 While it is possible to use an anonymous function with the set interval function, 5 00:00:15,854 --> 00:00:20,647 we shouldn't really use one in this application, let me show you why. 6 00:00:20,647 --> 00:00:25,848 Let me cut and paste tickClock into this 7 00:00:25,848 --> 00:00:32,760 setInterval function, and make it anonymous. 8 00:00:32,760 --> 00:00:38,580 But what happens to the tickClock invocation outside of the setInterval? 9 00:00:38,580 --> 00:00:41,570 We don't have the function to call anymore, 10 00:00:41,570 --> 00:00:46,450 let's comment out this line, save, and preview it. 11 00:00:49,190 --> 00:00:55,371 We see clock goes here, and then it starts ticking, this behavior is not desirable. 12 00:00:55,371 --> 00:00:59,403 Because we need to update the clock display when the page loads, 13 00:00:59,403 --> 00:01:03,380 we can't wait for the first setInterval call. 14 00:01:03,380 --> 00:01:08,310 The clock application isn't really suited for an anonymous function. 15 00:01:08,310 --> 00:01:13,321 So I'm going to revert my code back to include the named function, tickClock. 16 00:01:16,247 --> 00:01:18,214 Being comfortable using named and 17 00:01:18,214 --> 00:01:24,010 anonymous callbacks in other functions is required for any JavaScript programmer. 18 00:01:24,010 --> 00:01:28,440 After you've experimented with the code, you'll need to exercise judgment. 19 00:01:28,440 --> 00:01:30,570 And when you start making judgment calls like that, 20 00:01:30,570 --> 00:01:32,690 you're becoming a more mature developer