We learned about both for and while. So let’s get a comperasion today!

See both in one go

In while Normally we have

while (condition) {
  // code block to be executed
}

In For Normally we have

for (initial, condition, increment/decrement/rulesBreaking) {
  // code block to be executed
}

So basically both do the same work in different style right ?

Yaah that’s true. Now it’s your choice which one you want to use!

For loop is more readable in my sense, so I use for loop more.

Which loop you like most and why ?

Are you enjoying this series ?

See the codes – https://github.com/nerdjfpb/javaScript-Series

Find me on social media – twitter, linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *