background top icon
background center wave icon
background filled rhombus icon
background two lines icon
background stroke rhombus icon

Download "💻 Циклы while и do..while в JavaScript - основы JavaScript"

input logo icon
Video tags
|

Video tags

JavaScript
NodeJS
Metarhia
Programming
Шемсединов
Shemsedinov
node.js
уроки
программирование
js
курс
основы
для начинающих
node
backend
frontend
курсы
джаваскрипт
api
задачи
решения
ит
it
образование
education
metaeducation
Метархия
Subtitles
|

Subtitles

subtitles menu arrow
  • ruRussian
Download
00:00:00
let's look at we also have
00:00:03
while cycles, food Vile,
00:00:05
how they differ in that the file is a so-
00:00:09
called cycle with a precondition while with a
00:00:12
postcondition, and
00:00:14
just like the fore inside,
00:00:18
we can specify an
00:00:22
expression that will be calculated and
00:00:26
here let's say and less than 10 means
00:00:30
that you need to execute a block of operators
00:00:32
that, after the file, should be executed
00:00:36
while a is less than ten, as soon as a is
00:00:40
greater than or equal to 10, you need to
00:00:42
urgently exit this loop. In this
00:00:46
example code, we have the beginning of a equal to zero,
00:00:50
then at the first iteration, a plus plus
00:00:53
increases
00:00:54
a by one and then again the control
00:00:58
goes to the beginning of this cycle, we
00:01:01
compare and it is already equal to one, one is
00:01:04
still less than 10,
00:01:07
this means that we need to execute the
00:01:09
lacquer console again and now here it is
00:01:12
already equal to two and this
00:01:18
piece of code will actually give us all the
00:01:22
values ​​from zero to nine like this and here’s
00:01:27
an example let’s la which also displays the
00:01:29
same column from the value from 0 to 9
00:01:33
only here we
00:01:35
moved the condition to the end of the loop and
00:01:39
then wrote a block of operators and at
00:01:42
the end of the vile that is, execute this block
00:01:46
while the
00:01:47
value is inside, or
00:01:50
rather the expression inside the file there will be a corpse
00:01:53
and here we execute
00:01:57
comparing at the beginning of the loop and here comparing
00:02:00
at the end of the loop that is,
00:02:02
in fact,
00:02:04
but in this case it will be approximately
00:02:08
the same and will output the same to us, but we
00:02:11
sometimes want
00:02:13
to compare before the block of operators, sometimes
00:02:16
after the block of operators,
00:02:19
so let's now try
00:02:23
what do we need to do to
00:02:26
pause work in the middle of the cycle?
00:02:30
Here we have a cycle file and
00:02:32
here we go through the same process from
00:02:36
zero to ten to 9 until it
00:02:41
is less than ten,
00:02:44
increase it and by one then print the
00:02:47
line hallow and print the
00:02:50
number that we have
00:02:53
inside oh there is an example
00:02:57
of the output here, and
00:03:00
now we also have them inside, we will put them
00:03:04
here we compare in efi if i is 5 in
00:03:09
this case we want to exit the current iteration
00:03:11
but continue further and calibrate
00:03:15
that is, we want the control and the
00:03:18
lines in which written conti new
00:03:21
again returned to the beginning at the beginning of
00:03:24
this cycle and the
00:03:26
execution was repeated, well, at the next
00:03:29
iteration we already have since it
00:03:31
has increased by one and will already be
00:03:33
equal to 6, so continue will not be executed and
00:03:36
so we can follow the output here
00:03:40
we have hello 1 world hello 2 and
00:03:44
so it came to hello 5 but after
00:03:47
hello 5 world it didn’t become clear why this
00:03:49
happened because conti new threw
00:03:52
us to execute the loop from the beginning and the line
00:03:58
console legs world did not execute well and
00:04:01
then we exited the loop when and
00:04:04
became equal to 10 we went out and
00:04:09
basically wrote the console log
00:04:13
and in this way,
00:04:16
so
00:04:18
let’s also see that we have
00:04:21
break, from the previous example we
00:04:24
replaced continue with break, and in this
00:04:28
case, as soon as ours became equal to
00:04:31
five, we did not switch to execution here,
00:04:34
but just immediately left this cycle, that
00:04:37
is, here as soon as Hello 5, that’s all
00:04:40
at once and we can leave the cycle, well,
00:04:44
usually this is done according to some condition, of
00:04:46
course, in the same way, conti new and
00:04:50
break will work until for the for
00:04:53
of and for in loops which we did last time
00:04:56
saw that is, we can use
00:04:58
continue and break in cycles of Vile duvall
00:05:03
for four of and for and that is, in all
00:05:07
cycles we
00:05:08
break and continue
00:05:10
can
00:05:13
now apply some real application,
00:05:16
let's say we have a sum function and we
00:05:19
pass some kind of the number
00:05:23
of arguments, well, we don’t know in advance
00:05:25
how many were passed here again, this is
00:05:28
the number one two three four five could 10
00:05:31
pass could 100 pass we
00:05:33
don’t know in advance how many arguments we
00:05:35
will pass there and we want to write a function
00:05:38
in such a way that we firstly have all the
00:05:40
arguments which come here ended up in the
00:05:45
arks array and then we go through these
00:05:50
arguments until they run out and as
00:05:54
soon as they run out we put them all in
00:05:56
and in general this way we
00:05:59
calculated the sum, well, we don’t
00:06:01
understand everything in this function yet, but
00:06:04
let’s look at it line by line due to the rest
00:06:08
here we have the
00:06:09
rest operator which we have already seen
00:06:12
further, I will pour a variable at the beginning of
00:06:16
my functions and update it as they say, in general
00:06:20
we assign 0 there, then we go in a loop
00:06:23
until the
00:06:24
arguments, well, the length of the array is greater than zero
00:06:28
until
00:06:29
we haven’t looked at arrays yet, haven’t studied them, but
00:06:33
I’ll tell you in advance I will say that arks. dad,
00:06:37
in general, takes
00:06:40
one value from the array and
00:06:44
in the array it naturally becomes one
00:06:46
less value and we took it from the
00:06:49
array, added up our values ​​in the array, it became
00:06:53
one less value and
00:06:55
we have arcs in the pursuing pass in the loop. lance is less
00:06:59
by one and at some point there will be
00:07:01
nothing left there
00:07:03
as soon as there is nothing left here we will
00:07:06
exit this cycle and immediately return what we have
00:07:09
accumulated in value because we
00:07:11
have been adding the value from
00:07:15
this array all the time
00:07:18
were formed as a goal, that is, we
00:07:20
will calculate the sum here, so this is the
00:07:22
sum function that is more universal than the
00:07:24
one we wrote with two numbers up
00:07:27
in the previous example,
00:07:30
well, we can also rewrite this
00:07:34
same function with a dual, well, you
00:07:38
can also trace it here Well, here we’ll also
00:07:42
add a
00:07:44
comparison of the length of the array to 0, if there’s
00:07:47
nothing in the array there and immediately return 0,
00:07:50
we can optimize and
00:07:54
then
00:07:55
declare the variable again in the loop,
00:07:58
take the next value from the array
00:08:01
again, reach the end of the array and
00:08:05
give it the target, you can write it like this
00:08:08
So, in general, the sum function can be
00:08:10
written in probably
00:08:11
countless ways, and later we
00:08:14
will see much
00:08:17
better ways of how to add all the numbers from
00:08:21
an array, and here is
00:08:23
another such example, this is the slip function,
00:08:28
here we also don’t know everything, we don’t
00:08:30
know what
00:08:33
Newgate does but we will assume that this is the
00:08:37
whole line, this whole function on y, it
00:08:40
simply returns the value of number, the
00:08:44
current time represented in a
00:08:48
value of type number and
00:08:52
now we call we will use the
00:08:56
function on y, we will use it
00:08:59
inside the slip function, but by name we
00:09:02
can have several call it once and
00:09:05
in fact, this is
00:09:07
like a function that allows us not to
00:09:11
write the same thing twice,
00:09:12
here we
00:09:16
actually have this on y
00:09:19
calculated twice, we could generally have the
00:09:21
same value just write newgate in both places
00:09:24
.
00:09:27
bedtime and here and here write well, in
00:09:30
fact, the java script will most likely be
00:09:33
optimized and substitute this
00:09:36
expression
00:09:37
in instead of calling functions, this is called
00:09:42
yang lining but you don’t
00:09:46
actually need what will happen here on
00:09:50
y will return the current time and we
00:09:54
we want to
00:09:55
spin this drain, spin the loop until a
00:09:59
certain interval passes,
00:10:03
this interval in milliseconds is
00:10:06
passed to the slip function, we call it on
00:10:10
y and
00:10:12
add it with the interval, that is, here we
00:10:17
add the number of milliseconds at the current moment with here we have five thousand with
00:10:21
five thousand, the current time plus 5000
00:10:25
milliseconds and now we rotate the loop until
00:10:28
our function on y returns a value
00:10:32
less than the end, we immediately calculated
00:10:35
what time should be at the end of
00:10:39
our wait for this loop
00:10:42
and
00:10:43
wait until the function on y begins
00:10:47
to return and that’s each once we have a
00:10:49
wile, the function on is called again
00:10:52
and it returns the current time there again,
00:10:56
it is still less than the end, which
00:10:58
means again
00:10:59
wild once again executes this cycle, because
00:11:03
here we have this example, I specifically brought this example here
00:11:06
because here we have a cycle without a
00:11:09
body it will simply fulfill the same condition all the time,
00:11:11
but there is no block of
00:11:13
operators at all,
00:11:16
but it will constantly call the function
00:11:19
on y until it becomes
00:11:22
equal to or greater than ind and as soon as this
00:11:26
happens we will exit the slip functions in this
00:11:29
way when we write slide 5 thousand y
00:11:31
we
00:11:33
can no longer execute anything in the program
00:11:36
and we will wait 5 seconds for at
00:11:39
least five seconds
00:11:40
until we exit this function like
00:11:46
this, you can also use the wild loop

Description:

Патреон: https://www.patreon.com/tshemsedinov Github автора: https://github.com/tshemsedinov Группа в телеграме: https://t.me/metaedu

Preparing download options

popular icon
Popular
hd icon
HD video
audio icon
Only sound
total icon
All
* — If the video is playing in a new tab, go to it, then right-click on the video and select "Save video as..."
** — Link intended for online playback in specialized players

Questions about downloading video

mobile menu iconHow can I download "💻 Циклы while и do..while в JavaScript - основы JavaScript" video?mobile menu icon

  • http://unidownloader.com/ website is the best way to download a video or a separate audio track if you want to do without installing programs and extensions.

  • The UDL Helper extension is a convenient button that is seamlessly integrated into YouTube, Instagram and OK.ru sites for fast content download.

  • UDL Client program (for Windows) is the most powerful solution that supports more than 900 websites, social networks and video hosting sites, as well as any video quality that is available in the source.

  • UDL Lite is a really convenient way to access a website from your mobile device. With its help, you can easily download videos directly to your smartphone.

mobile menu iconWhich format of "💻 Циклы while и do..while в JavaScript - основы JavaScript" video should I choose?mobile menu icon

  • The best quality formats are FullHD (1080p), 2K (1440p), 4K (2160p) and 8K (4320p). The higher the resolution of your screen, the higher the video quality should be. However, there are other factors to consider: download speed, amount of free space, and device performance during playback.

mobile menu iconWhy does my computer freeze when loading a "💻 Циклы while и do..while в JavaScript - основы JavaScript" video?mobile menu icon

  • The browser/computer should not freeze completely! If this happens, please report it with a link to the video. Sometimes videos cannot be downloaded directly in a suitable format, so we have added the ability to convert the file to the desired format. In some cases, this process may actively use computer resources.

mobile menu iconHow can I download "💻 Циклы while и do..while в JavaScript - основы JavaScript" video to my phone?mobile menu icon

  • You can download a video to your smartphone using the website or the PWA application UDL Lite. It is also possible to send a download link via QR code using the UDL Helper extension.

mobile menu iconHow can I download an audio track (music) to MP3 "💻 Циклы while и do..while в JavaScript - основы JavaScript"?mobile menu icon

  • The most convenient way is to use the UDL Client program, which supports converting video to MP3 format. In some cases, MP3 can also be downloaded through the UDL Helper extension.

mobile menu iconHow can I save a frame from a video "💻 Циклы while и do..while в JavaScript - основы JavaScript"?mobile menu icon

  • This feature is available in the UDL Helper extension. Make sure that "Show the video snapshot button" is checked in the settings. A camera icon should appear in the lower right corner of the player to the left of the "Settings" icon. When you click on it, the current frame from the video will be saved to your computer in JPEG format.

mobile menu iconWhat's the price of all this stuff?mobile menu icon

  • It costs nothing. Our services are absolutely free for all users. There are no PRO subscriptions, no restrictions on the number or maximum length of downloaded videos.