{"id":2626,"date":"2022-06-15T20:49:58","date_gmt":"2022-06-16T00:49:58","guid":{"rendered":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/?p=2626"},"modified":"2022-06-15T20:49:58","modified_gmt":"2022-06-16T00:49:58","slug":"week-10-and-11","status":"publish","type":"post","link":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/2022\/06\/15\/week-10-and-11\/","title":{"rendered":"Week 10 and 11"},"content":{"rendered":"<p><strong><span style=\"font-size: 18pt\">Week 10<\/span><\/strong><\/p>\n<p>A JavaScript function is a chunk of code designed to perform a particular task, such as calculation. Every function has a name, a list of parameters to the function, enclosed in parentheses and separated by commas, and statements that define the function, inside curly brackets.<\/p>\n<p>Here is a example of a simple function<\/p>\n<p>console.log(&#8216;Hello World&#8217;);<\/p>\n<p>If you want to have an alert box, you can type:<\/p>\n<p>alert(&#8220;Hello World&#8221;);<\/p>\n<p>if you want to have the words, write:<\/p>\n<p>document.write(&#8216;Hello World&#8221;);<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-2627\" src=\"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/files\/2022\/06\/javascript-alert-300x197.png\" alt=\"\" width=\"300\" height=\"197\" srcset=\"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/files\/2022\/06\/javascript-alert-300x197.png 300w, https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/files\/2022\/06\/javascript-alert.png 610w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><strong><span style=\"font-size: 18pt\">Week 11<\/span><\/strong><\/p>\n<p><em>Why do we use if\/else statements?<\/em><\/p>\n<p>It is used to perform different actions based on different conditions.<\/p>\n<p>The if\/else statement executes a block of code if a specified condition is true. If the condition is false, another block of code can be executed.<\/p>\n<p>It works like:<\/p>\n<p>if name = &#8220;Joe&#8221;;<br \/>\n{<br \/>\nalert(&#8220;hey Joe&#8221;);<br \/>\n}<br \/>\nelse if (name = &#8220;Bob&#8221;);<br \/>\n{<br \/>\nalert(&#8220;Hey Bob&#8221;)<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Week 10 A JavaScript function is a chunk of code designed to perform a particular task, such as calculation. Every function has a name, a list of parameters to the function, enclosed in parentheses and separated by commas, and statements that define the function, inside curly brackets. Here is a example of a simple function [&hellip;]<\/p>\n","protected":false},"author":28306,"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-2626","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\/2626","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\/28306"}],"replies":[{"embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/comments?post=2626"}],"version-history":[{"count":1,"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/posts\/2626\/revisions"}],"predecessor-version":[{"id":2628,"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/posts\/2626\/revisions\/2628"}],"wp:attachment":[{"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/media?parent=2626"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/categories?post=2626"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/community.mis.temple.edu\/mis2101sec712summer2022\/wp-json\/wp\/v2\/tags?post=2626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}