{"id":357,"date":"2010-08-16T03:25:26","date_gmt":"2010-08-16T07:25:26","guid":{"rendered":"http:\/\/www.searchenginegenie.com\/programming-blog\/?p=357"},"modified":"2012-12-11T02:33:35","modified_gmt":"2012-12-11T06:33:35","slug":"switch-case-in-java-script","status":"publish","type":"post","link":"https:\/\/www.searchenginegenie.com\/programming-blog\/switch-case-in-java-script\/","title":{"rendered":"Switch Case in Java Script"},"content":{"rendered":"<p>[php]<\/p>\n<p>&lt;html&gt;<br \/>\n &lt;body&gt;<br \/>\n &lt;head&gt;<br \/>\n &lt;title&gt;Switch Case &lt;\/title&gt;<br \/>\n &lt;\/head&gt;<br \/>\n &lt;body&gt;<br \/>\n &lt;script type=&quot;text\/javascript&quot;&gt;<br \/>\n var d = new Date();<br \/>\n theDay=d.getDay();<br \/>\n switch (theDay)<br \/>\n {<br \/>\n case 5:<br \/>\n document.write(&quot;&lt;b&gt;Finally Friday&lt;\/b&gt;&quot;);<br \/>\n break;<br \/>\n case 6:<br \/>\n document.write(&quot;&lt;b&gt;Super Saturday&lt;\/b&gt;&quot;);<br \/>\n break;<br \/>\n case 0:<br \/>\n document.write(&quot;&lt;b&gt;Sleepy Sunday&lt;\/b&gt;&quot;);<br \/>\n break;<br \/>\n default:<br \/>\n document.write(&quot;&lt;b&gt;I&#8217;m really looking forward to this weekend!&lt;\/b&gt;&quot;);<br \/>\n }<br \/>\n &lt;\/script&gt;<br \/>\n &lt;\/body&gt;<br \/>\n &lt;\/html&gt;<\/p>\n<p>[\/php]<\/p>\n<p>\/*This JavaScript will generate a different greeting based on what day it is. Note that Sunday=0, Monday=1, Tuesday=2, etc.*\/<\/p>\n<p>Output:<\/p>\n<p><strong>I&#8217;m really looking forward to this weekend!<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>[php] &lt;html&gt; &lt;body&gt; &lt;head&gt; &lt;title&gt;Switch Case &lt;\/title&gt; &lt;\/head&gt; &lt;body&gt; &lt;script type=&quot;text\/javascript&quot;&gt; var d = new Date(); theDay=d.getDay(); switch (theDay) { case 5: document.write(&quot;&lt;b&gt;Finally Friday&lt;\/b&gt;&quot;); break; case 6: document.write(&quot;&lt;b&gt;Super Saturday&lt;\/b&gt;&quot;); break; case 0: document.write(&quot;&lt;b&gt;Sleepy Sunday&lt;\/b&gt;&quot;); break; default: document.write(&quot;&lt;b&gt;I&#8217;m really looking forward to this weekend!&lt;\/b&gt;&quot;); } &lt;\/script&gt; &lt;\/body&gt; &lt;\/html&gt; [\/php] \/*This JavaScript will generate a different greeting [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-357","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/posts\/357","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/comments?post=357"}],"version-history":[{"count":4,"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/posts\/357\/revisions"}],"predecessor-version":[{"id":560,"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/posts\/357\/revisions\/560"}],"wp:attachment":[{"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/media?parent=357"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/categories?post=357"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/tags?post=357"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}