{"id":212,"date":"2013-06-19T18:18:20","date_gmt":"2013-06-20T01:18:20","guid":{"rendered":"http:\/\/courses.haigarmen.com\/isma309\/?p=212"},"modified":"2013-06-19T19:23:30","modified_gmt":"2013-06-20T02:23:30","slug":"functions","status":"publish","type":"post","link":"https:\/\/courses.haigarmen.com\/isma309\/functions\/","title":{"rendered":"Functions"},"content":{"rendered":"<p>Prose is structured in sentences and paragraphs in the english language. In Javascript we structure our code in lines of instruction and <strong>functions<\/strong>.<\/p>\n<p>To create javascript that is easy to understand and maintain the code must be broken into  smaller modules. These modules or packages of instructions are called functions and can be called upon to be executed from other parts of your program. Essentially, functions are chunks of code. Enough talk, let\u2019s create a function:<\/p>\n<pre lang=\"javascript\">\r\n\tfunction test()\r\n\t\t{\r\n   \t\t\tdocument.write(\"Hello can you see me?\")\r\n\t\t}\r\n<\/pre>\n<p>Note that if only this were within your &lt;script&gt;&lt;\/script&gt; tags, you will not see &#8220;Hello can you see me?&#8221; on your screen because functions are not executed by themselves until you call upon them. So we should do something:<\/p>\n<pre lang=\"javascript\">\r\n\tfunction test()\r\n\t\t{\r\n\t\t\tdocument.write(\"Hello can you see me?\")\r\n\t\t}\r\n\ttest() \r\n<\/pre>\n<p>The last line <strong>test()<\/strong> calls the function, now you will see the words \u201cHello can you see me?\u201d.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Prose is structured in sentences and paragraphs in the english language. In Javascript we structure our code in lines of instruction and functions. To create javascript that is easy to understand and maintain the code must be broken into smaller modules. These modules or packages of instructions are called functions and can be called upon [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,7],"tags":[],"class_list":["post-212","post","type-post","status-publish","format-standard","hentry","category-exercises","category-javascript"],"_links":{"self":[{"href":"https:\/\/courses.haigarmen.com\/isma309\/wp-json\/wp\/v2\/posts\/212","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/courses.haigarmen.com\/isma309\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.haigarmen.com\/isma309\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.haigarmen.com\/isma309\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.haigarmen.com\/isma309\/wp-json\/wp\/v2\/comments?post=212"}],"version-history":[{"count":14,"href":"https:\/\/courses.haigarmen.com\/isma309\/wp-json\/wp\/v2\/posts\/212\/revisions"}],"predecessor-version":[{"id":234,"href":"https:\/\/courses.haigarmen.com\/isma309\/wp-json\/wp\/v2\/posts\/212\/revisions\/234"}],"wp:attachment":[{"href":"https:\/\/courses.haigarmen.com\/isma309\/wp-json\/wp\/v2\/media?parent=212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/isma309\/wp-json\/wp\/v2\/categories?post=212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.haigarmen.com\/isma309\/wp-json\/wp\/v2\/tags?post=212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}