Computer Science, asked by spondongogoi98, 11 months ago

Why loop is used in javascript?

Answers

Answered by Tajeshsahu
1

Answer:

how to use loop in javascript -

Loops are useful when you have to execute the same lines of code repeatedly, for a specific number of times or as long as a specific condition is true. Suppose you want to type a ‘Hello’ message 100 times in your webpage. Of course, you will have to copy and paste the same line 100 times. Instead, if you use loops, you can complete this task in just 3 or 4 lines.

Explanation:

The statement1 is executed first even before executing the looping code. So, this statement is normally used to assign values to variables that will be used inside the loop.

The statement2 is the condition to execute the loop.

The statement3 is executed every time after the looping code is executed.

Answered by saanvi83
2

Answer:

Hey Hi...

Explanation:

JavaScript loop are used to you repeatedly run a block of code - until a certain condition is met.When developers talk about iteration or iterating over, say, an array , it is the same as looping . JavaScript offers several points to repeatedly run a block of code, including while, do while, for and for - in.

Please mark my answer as a brainliest answer ❤️❤️❤️

I hope it helps you ❤️ ❤️❤️

Follow me I'm also follow you back ❤️ ❤️❤️

Similar questions