{"id":2610,"date":"2022-06-15T17:43:20","date_gmt":"2022-06-15T21:43:20","guid":{"rendered":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/?p=2610"},"modified":"2022-06-15T17:43:20","modified_gmt":"2022-06-15T21:43:20","slug":"why-use-loops","status":"publish","type":"post","link":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/2022\/06\/15\/why-use-loops\/","title":{"rendered":"Why use loops?"},"content":{"rendered":"<p>Looping in JavaScript is a feature which executes a set of instructions repeatedly. In an example we went over in previous classes, if we wanted to say &#8220;hello world&#8221; ten times. This set of instructions could be done in two different ways. One method is to write the command &#8220;hello world&#8221; ten separate times. A much more efficient to get this result is to use a for loop.\u00a0<\/p>\n<p>An example of what a for loop would look like in JavaScript is shown below:<\/p>\n<p>vari;<\/p>\n<p>for (i = 0; i &lt; 10; i++)<\/p>\n<p>{<\/p>\n<p>document.write(&#8220;hello world&#8221;);<\/p>\n<p>}<\/p>\n<p>The first i shows that the program will begin at zero. The second i shows that the program will not generate &#8220;hello world&#8221; more than ten times. The third i shows that i will increase in increments of one.\u00a0<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Looping in JavaScript is a feature which executes a set of instructions repeatedly. In an example we went over in previous classes, if we wanted to say &#8220;hello world&#8221; ten times. This set of instructions could be done in two different ways. One method is to write the command &#8220;hello world&#8221; ten separate times. A [&hellip;]<\/p>\n","protected":false},"author":28304,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[663943],"tags":[],"class_list":{"0":"post-2610","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-instructor","7":"entry"},"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/posts\/2610","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/users\/28304"}],"replies":[{"embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/comments?post=2610"}],"version-history":[{"count":1,"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/posts\/2610\/revisions"}],"predecessor-version":[{"id":2622,"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/posts\/2610\/revisions\/2622"}],"wp:attachment":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/media?parent=2610"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/categories?post=2610"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/tags?post=2610"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}