{"id":41480,"date":"2021-05-08T05:55:31","date_gmt":"2021-05-08T05:55:31","guid":{"rendered":"https:\/\/www.oracletutoring.ca\/blog\/?p=41480"},"modified":"2021-05-08T05:55:33","modified_gmt":"2021-05-08T05:55:33","slug":"comp-sci-fantastic-javascript","status":"publish","type":"post","link":"https:\/\/www.oracletutoring.ca\/blog\/comp-sci-fantastic-javascript\/","title":{"rendered":"Comp-sci: fantastic JavaScript"},"content":{"rendered":"\n<h2>Self-tutoring about programming languages: the tutor mentions a neat feature of JavaScript.<\/h2>\n<p>Scripting languages are great because they can do so much with so little. Therefore, Perl and Awk are a couple of favourites. What about JavaScript?<\/p>\n<p>Let&#8217;s say , in JavaScript, var z=-3. Then (z? 10:20) will return 10. If z=0 or z is undefined, (z? 10:20) will return 20. ?: makes up the JavaScript conditional operator. The question mark evaluates if z is true (assigned nonzero value). If true, the number before the colon is returned, which is 10 in this case. However, if z is 0 or null, the number after the colon, 20, is returned. An error is returned is z was never defined.<\/p>\n<p>Neat, eh?<\/p>\n<p>Source:<\/p>\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Operators\/Conditional_Operator\">developer.mozilla.org<\/a><\/p>\nJack of <a href=\"https:\/\/www.oracletutoring.ca\">Oracle Tutoring by Jack and Diane,<\/a> Campbell River, BC. \n","protected":false},"excerpt":{"rendered":"<p>Self-tutoring about programming languages: the tutor mentions a neat feature of JavaScript. Scripting languages are great because they can do so much with so little. Therefore, Perl and Awk are a couple of favourites. What about JavaScript? Let&#8217;s say , &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.oracletutoring.ca\/blog\/comp-sci-fantastic-javascript\/\"> <span class=\"screen-reader-text\">Comp-sci: fantastic JavaScript<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[105],"tags":[],"class_list":["post-41480","post","type-post","status-publish","format-standard","hentry","category-computer-science"],"_links":{"self":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/41480","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/comments?post=41480"}],"version-history":[{"count":3,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/41480\/revisions"}],"predecessor-version":[{"id":41483,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/41480\/revisions\/41483"}],"wp:attachment":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/media?parent=41480"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/categories?post=41480"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/tags?post=41480"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}