JavaScript Tutorial for Beginners - 12 - Loops Part 2

preview_player
Показать описание
Loops in Javascript.
Рекомендации по теме
Комментарии
Автор

Finally I understand for loops!!! Until now, I've always found them to be super confusing for some reason!!

powderberrykun
Автор

Hey EJ
hows it going there?
congrats on the great tutorials you make
I have been going thru all over the internet to find a clear JS tutorial.
Yours are truly clear and simpe to understand.
keep up the good work!

leandrodossantos
Автор

And finally, for the first time.The secret technique have been solved to my brain that make my brain goes in loops for days :)

djpro
Автор

Thanks for keeping up the good work. JavaScript's syntax is a lot like the one used in C (a programming language I know) and you've managed to point out certain aspects of "for" loops that I never really noticed. For example, being more convenient if the code within the loop is really long.

Monkeyradar
Автор

I like the following explanation much better:

A for loop is used when you know how many times you will be going through the loop. A while loop is for when you want to keep looping until a condition changes.

gmc
Автор

Hello, I am learning HTML, CSS, JAVASCRIPT from you, you are doing a great job! A great Teacher!, I wish is to, please reveal your face...I wanna see that how the best teacher of coding in youtube looks like?

megalegendyt
Автор

THANK YOU SO MUCH! You deserve way more likes and subscribers.

Ryan-fldz
Автор

Another reason for using the for(...){} syntax over the while(...){} syntax in the example is because of something called "scope". The "scope" of a value means the parts of the code that can use a value.

for (var i = 1; i < 5; i++)
{
only code in here can see and use i
}

code here can not see or use i.


where as:


var i = 1;
while(i < 5)
{
code here can see and use i
}

code here can also see and use i, and will use the value that i has when the loop has finished (in the case of the example this is 5).

duncanmcdonald
Автор

mind blowing
whats a technique to explain

bablugope
Автор

can i reuse the "var i" from the loop at a different place as a variable?

har_h
Автор

Hello +EJ Media, what screen recorder do you use ?? Because my pc is really slow and i'll look if your screen recorder works with my horrible PC !!!!

kleozane
Автор

are their any slight differences or did the java people just develop two commands that do the same thing

inafridge
Автор

u should have mentioned that in javascript u commented out the while loop using /* & */ at the beginning and at the end respectively. Is this a way to comment out anything in JavaScript

ammarsadeq
Автор

if u want it run 5 times u can do
for(var i = 0; i < 5; i++)
then ur code

tastyl
Автор

hey man can you show us how to use javascript in websites

yogeshsingh