+ 6

What os the difference between loops and statements in javascript

18th Jul 2018, 10:08 PM
Webster
Webster - avatar
5 Answers
+ 6
Like this : while (statements) { //do something. }
18th Jul 2018, 10:33 PM
Warith Vatanaplachaigoon
Warith Vatanaplachaigoon - avatar
+ 5
Loops will occur while the statements are true.
18th Jul 2018, 10:32 PM
Warith Vatanaplachaigoon
Warith Vatanaplachaigoon - avatar
+ 5
The difference between loops and statements in ANY language is this: Loops are for doing something repeatedly. Statements are for doing something once. E.g. (specifically for js) for(var i=0; i<100; i++) { console.log(i); } //outputs all numbers from 0 to 99 console.log(5); //outputs 5 once
19th Jul 2018, 7:44 AM
Haris
Haris - avatar
+ 1
If you are talking about conditional statement and loops Conditional Statement : Conditional statement are used to control the flow means if some condition is true than only execute certain statement. Loops : Loops are used to repeat a block of statement if certain condition are true. Hope this helpsâ˜șâ˜ș.
19th Jul 2018, 9:11 AM
Meet Mehta
Meet Mehta - avatar
0
Depending on the type of loop, the loop just makes a piece of code run i # of times, or for each occurrence of a variable in a container (array, vector...), or until a condition set by the user becomes true. The conditions of the loop's stopping point and the code in the body of the loop are your statements in a loop. A statement can run only once outside of a loop also.
26th Sep 2018, 1:29 PM
Darren Moody
Darren Moody - avatar