{"id":901,"date":"2022-07-11T16:32:24","date_gmt":"2022-07-11T16:32:24","guid":{"rendered":"https:\/\/gyanipandit.com\/programming\/?p=901"},"modified":"2023-04-25T19:32:09","modified_gmt":"2023-04-25T19:32:09","slug":"loop-javascript","status":"publish","type":"post","link":"https:\/\/gyanipandit.com\/programming\/loop-javascript\/","title":{"rendered":"Looping in JavaScript"},"content":{"rendered":"<p style=\"text-align: center;\"><strong>Loop JavaScript<\/strong><\/p>\n<p>There are many cases when we need to do something repeatedly, like 100 times, 1000 times, or even more times. So, what if I tell you to console.log the value of some integer, then increment it, and again console.log the new incremented value of that integer, and if I tell you to do the same thing 100 times!!! are you going to write console.log and that all program for so many times?? NO WAY!<\/p>\n<p>But thanks to loops, they make this thing so much easy for us to do.<\/p>\n<h2 style=\"text-align: center;\">Loop JavaScript<\/h2>\n<p><iframe loading=\"lazy\" title=\"Loops in Javascript | Lecture 28 | JavaScript for Beginners\" width=\"696\" height=\"392\" src=\"https:\/\/www.youtube.com\/embed\/uYHlMCtz9R0?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>We are going to have a look at some of the loops in <a href=\"https:\/\/gyanipandit.com\/programming\/javascript\/\">javascript<\/a>, like the for loop, and while loop, and they do&#8230; while loop. But first of all, let&#8217;s get the overall idea about what we are going to do &#8211;<\/p>\n<p>So, this is what we are going to do &#8211;<br \/>\nStep 1 \u2013 You have to write the code only once, that you want to execute A NUMBER OF TIMES!!<br \/>\nStep 2 \u2013 Put it inside the loop.<br \/>\nStep 3 \u2013 Run the program.<\/p>\n<p>And yes&#8230; you are done. This is all we got to do. This is when we want to do something a number of times, we are going to make use of the loops.<\/p>\n<p>As soon as we start making use of different loops, you would get used to it.<\/p>\n<p>But if you are not getting the whole thing, just do not worry at all. Just understand that the loops are used for executing repeated operations\/ instructions.<\/p>\n<p>Well, as stated earlier, we are going to have a look at the for loop, and the while loop and they do&#8230; while loop.<\/p>\n<p>So, let&#8217;s consider those loops one by one &#8211;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Loop JavaScript There are many cases when we need to do something repeatedly, like 100 times, 1000 times, or even more times. So, what if I tell you to console.log the value of some integer, then increment it, and again console.log the new incremented value of that integer, and if I tell you to do [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[14,15],"class_list":{"0":"post-901","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-javascript-tutorial","7":"tag-javascript","8":"tag-javascript-tutorial"},"_links":{"self":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/901","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/comments?post=901"}],"version-history":[{"count":5,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/901\/revisions"}],"predecessor-version":[{"id":6073,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/901\/revisions\/6073"}],"wp:attachment":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/media?parent=901"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/categories?post=901"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/tags?post=901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}