1 00:00:00,160 --> 00:00:04,935 Another way you might write a loop is with the for of loop, like for each, 2 00:00:04,935 --> 00:00:09,310 for of creates a loop that repeats an action a given number of times. 3 00:00:09,310 --> 00:00:14,340 You create a for of loop with the keyword, for 4 00:00:14,340 --> 00:00:18,610 followed by a parentheses and curly braces. 5 00:00:18,610 --> 00:00:21,230 Inside the parentheses, you provide for 6 00:00:21,230 --> 00:00:25,570 of a variable that represents the current item being processed in the loop. 7 00:00:25,570 --> 00:00:30,540 This is very similar to the movie parameter we just used inside for each. 8 00:00:30,540 --> 00:00:35,650 So I'll again call the variable movie with var movie, and 9 00:00:35,650 --> 00:00:40,990 you could also the let and const keywords I mentioned earlier here in place of var. 10 00:00:40,990 --> 00:00:44,530 Now I'll follow the variable with the keyword of and 11 00:00:44,530 --> 00:00:47,440 the name of the array we're looping over, in this case, movies. 12 00:00:49,250 --> 00:00:52,240 Inside the curly braces you provide a statement or 13 00:00:52,240 --> 00:00:57,730 action to be carried out for each element that gets passed into the loop. 14 00:00:57,730 --> 00:01:00,940 I'll simply log each movie title to the console 15 00:01:00,940 --> 00:01:05,860 with console.log and pass it in movie. 16 00:01:05,860 --> 00:01:09,960 So as you can see, this loop statement is pretty simple to read. 17 00:01:09,960 --> 00:01:13,030 It almost reads in plain English, for 18 00:01:13,030 --> 00:01:18,000 every movie of the movies array, log it to the console. 19 00:01:19,470 --> 00:01:23,170 I'll give this a save, refresh the browser, and 20 00:01:23,170 --> 00:01:27,420 now over in the console we see a list of all the titles stored in the movies array.