1
00:00:00,570 --> 00:00:06,210
Welcome to this section of JavaScript loops.

2
00:00:06,390 --> 00:00:08,700
So what is a loop?

3
00:00:08,730 --> 00:00:16,680
Well, as you could see, we are moving slowly, slowly by adding more things into our to toolbox as

4
00:00:16,680 --> 00:00:18,180
JavaScript developer.

5
00:00:18,630 --> 00:00:28,410
So the concept of a loop is the same across all programming languages, but always the syntax are always

6
00:00:28,410 --> 00:00:29,220
different.

7
00:00:29,370 --> 00:00:31,140
So what is a loop?

8
00:00:31,700 --> 00:00:41,180
JavaScript loops are a powerful programming tool that allows you to execute a block of code multiple

9
00:00:41,180 --> 00:00:42,180
times.

10
00:00:42,200 --> 00:00:50,990
Again, we or you can execute code multiple times the way you want it unless you tell it to stop.

11
00:00:51,770 --> 00:01:00,680
So for example, if you are playing videos on YouTube, you can say that, well, I want the video to

12
00:01:00,680 --> 00:01:01,700
repeat itself.

13
00:01:01,730 --> 00:01:04,879
After playing playback, playback, playback, playback.

14
00:01:04,879 --> 00:01:07,910
Until you are tired, that's what you call loop.

15
00:01:08,950 --> 00:01:11,110
And we why?

16
00:01:11,220 --> 00:01:13,540
There are many different types of loops.

17
00:01:13,540 --> 00:01:15,620
We have many types of loops.

18
00:01:15,640 --> 00:01:23,740
They all share a common structure, meaning when a condition is checked and if the condition is true,

19
00:01:23,740 --> 00:01:32,110
the code block is executed and this process is then repeated until the condition is no longer true.

20
00:01:32,140 --> 00:01:34,180
That's what you call loops.

21
00:01:34,450 --> 00:01:35,890
So let's say that.

22
00:01:35,890 --> 00:01:42,550
Well, let's come down a little bit and have some I mean, simpler, I mean scenario here.

23
00:01:43,270 --> 00:01:50,080
Let's say that we want to display numbers from 1 to 5.

24
00:01:50,410 --> 00:01:51,600
The one is easy, right?

25
00:01:51,610 --> 00:01:53,890
We can easily write console.log, console.log.

26
00:01:53,890 --> 00:01:55,750
One, two, three, four and five.

27
00:01:56,050 --> 00:02:01,240
But what about if you want to print, let's say, 1 billion from 1 to 1 billion?

28
00:02:01,600 --> 00:02:02,650
Can we do that?

29
00:02:02,890 --> 00:02:03,670
No.

30
00:02:03,700 --> 00:02:07,240
Let computer do it for us by writing code.

31
00:02:07,360 --> 00:02:11,260
So these are some of the critical examples why we need loops.

32
00:02:12,170 --> 00:02:14,990
So you would have more to talk about.

33
00:02:14,990 --> 00:02:16,210
Task of loops.

34
00:02:16,220 --> 00:02:17,450
Then this video.

35
00:02:17,480 --> 00:02:24,230
Let's start to see how we can write a loop to perform certain tags multiple times.

