RUVIDEO
Поделитесь видео 🙏

103 Labels -Loops within loops -JavaScript Tutorial 2018

📁 Обучение 👁️ 16 📅 02.12.2023

The Full #Javascript #tutorial for #beginners [#JS]: http://bizanosa.com/js

Learn HTML, CSS and JavaScript

http://bizanosa.com/sp/learn-html-css-javascript/

103 Labels Loops within loops example - JavaScript for Beginners.

This is a Javascript tutorial from scratch for any beginner. Use the above link to watch the full JS video tutorial..

Next Video: https://youtu.be/UYPUcZPReV8
Previous Video: https://youtu.be/2v-kDD-9hrk


Hi and welcome back.

So in the last video, we created this code and now we want to take this code so that we can make sure that those numbers are visible here.

And the way that I’m going to do that, I’m just going to copy this and Control+C.

Then I will come back into our script and you do remember all of this.

If you don’t, go back to the section where we took at detour and you will learn all this once again.

So the path that we are mostly interested in is this section whereby you can add an element in an id.

So if I come back to our HTML, we want to add it in this id.

You see this id which is empty, heading 2.

We want to select that element and then we want to add some things inside of it.

So let me come down here and just comment it as “LOOPS” so that when you get these files, you’ll know what was being done here, “LOOPS and Labels”.

So if I copy that in here, let me comment this one out.

So this part is the part that is responsible for saying this “I have been added”.

I just want to comment that out.

Control+Shift, and that will comment this one out for me.

Control+Shift+/ on my windows will comment all of this.

But I just realized, I don’t need to comment everything, I just need to comment this one because I want to use this very variable.

So if I come here, say Control that, and then I want to take this, Control+C and inside of console here where we’re doing our console, I want such that the value of ‘i’ is being, is being output for us.

Here, this part is where we want to add, this is where we want to add this.

We want to add the values of ‘i’.

This is what we were going to replace, “I have been added”.

You see that.

So you want to replace it with the values of, the values of ‘i’.

So addheading.innerHTML is equals to the value of ‘i’, ‘i’.

So let’s do a plus in front of this so that it will add them, all of them.

It’s going to list everything for us.

And then, also we want to add a space between them.

So remove this.

Add that space.

So just with this, if we run this, it’s going to give us the value of ‘i’ and it’s going to put that value right here.

So if I run this, you see it gives us this.

It gives us 1 once, twice, 2 twice, 3 thrice, 4 four times.

So that’s what you wanted to see, before we actually delved into how you can use these labels.

Now you can see here we have 2 labels.

The first label, you can see here we have 2 labels.

The first label is for the outside loop, that which covers everything, the entire loop, here.

And then we also have the inside label.

So how you can use labels is that, so for this one, let’s say that we want it such that if we reach a certain point, we just break out of it.

So let’s say if at some point the value of ‘i’, if the value of ‘i’ is equivalent to 3, then let’s break out.

So we can just do it in one line.

Break out of, what’s the name of the loop? Break outside of ‘outloop’.

So if (i===3) break outloop; so this will run outside of this loop.

It will go outside of it.

If I save this and the value of ‘i’ becomes 3, let’s see what happens.

So if you don’t have that section of break, this is what we’ll have.

But what if we do that? You see it will only print that and it will print the first 3.

And the reason it prints the first 3 is because this is below.

So what if I take it, Control+X and I put it at the very top here.

And let’s see if it’s going to print that 3.

So it’s not going to print it.

Now, what if we say that we just want such that when j===3, we’ll loop out of it.

So when j===3, let’s see.

If we run that, you’ll see that nothing really happens when j===3.

What if when j===2? So when j===2, at least it will break out.

So let me explain this code and how it runs.

So we’ve seen how you can use the loops, ok.

So you, how you can use the labels in the loops.

You can just give the loop a name and if there’s another loop inside of it, if something happens, you can break outside of the loop


.
GET SOCIAL WITH ME:
FACEBOOK: https://www.facebook.com/rwahowa/
INSTAGRAM: https://www.instagram.com/rwahowa/
TWITTER: https://twitter.com/rwahowa/
VIMEO: https://vimeo.com/bizanosa/
WEBSITE : http://rwahowa.com

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «103 Labels -Loops within loops -JavaScript Tutorial 2018», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.