{"id":20921,"date":"2016-03-29T03:01:03","date_gmt":"2016-03-28T17:01:03","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=20921"},"modified":"2016-03-29T11:52:16","modified_gmt":"2016-03-29T01:52:16","slug":"javascript-function-overload-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/javascript-function-overload-primer-tutorial\/","title":{"rendered":"Javascript Function Overload Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/ology_chalkboard.html\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"Javascript Function Overload Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/js_fo.jpg\" title=\"Javascript Function Overload Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Javascript Function Overload Primer Tutorial<\/p><\/div>\n<p>Today&#8217;s blog posting, long in the making, is about Javascript&#8217;s function override (or overload) capabilities.  We&#8217;ve spoken about this before in relation to C++ or Java with <a target=_blank title='Override or overload tutorials' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/overload'>these tutorials<\/a>.<\/p>\n<p>So let&#8217;s do a simple example first.  Take the Javascript global function <a target=_blank title='Javascript encodeURIComponent information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/jsref_encodeuricomponent.asp'><i>encodeURIComponent([String])<\/i><\/a> &#8230; <font size=1>to the seaside (would be nice)<\/font> &#8230; and the very similar, but not quite the same <a target=_blank title='Javascript encodeURI information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/jsref_encodeuri.asp'><i>encodeURI<\/i><\/a> &#8230; okay, time&#8217;s up.  Now examine two bits of code, the first from a parent HTML and the second from the HTML of its &#8220;child&#8221; iframe &#8230;<\/p>\n<p><code><br \/>\n  document.title=encodeURIComponent(\" The rain in Spain falls mainly on the plain. Yes? \");<br \/>\n<\/code><\/p>\n<p><code><br \/>\n  document.title=encodeURIComponent(\" The rain in Spain falls mainly on the plain. Yes? \");<br \/>\n<\/code><\/p>\n<p> &#8230; patently the same &#8230; but they result in different <i>document.title<\/i> results, as per, respectively &#8230;<\/p>\n<p><code><br \/>\n%20The%20rain%20in%20Spain%20falls%20mainly%20on%20the%20plain.%20Yes?%20<br \/>\n<\/code><\/p>\n<p><code><br \/>\n%20The%20rain%20in%20Spain%20falls%20mainly%20on%20the%20plain.%20Yes%3F%20<br \/>\n<\/code><\/p>\n<p>So how does this figure?  Well, the child HTML iframe call really calls the Javascript <i>encodeURIComponent<\/i> function, but the parent HTML call actually calls a local overload (or override) function within its own Javascript as per &#8230;<\/p>\n<p><code><br \/>\nfunction encodeURIComponent(es) {<br \/>\n  return encodeURI(es);<br \/>\n}<br \/>\n<\/code><\/p>\n<p> &#8230; and this shows that Javascript can perform some rudimentary overload (or override) methodologies, and how that &#8220;?&#8221; (not translated by <i>encodeURI<\/i>) is translated by the Javascript (native) <i>encodeURIComponent<\/i> function.<\/p>\n<p>You may wonder, at this point, why this blog posting took so long?  Well, the original &#8220;dream&#8221; with this work &#8230; <font size=1>which, by the way, cannot work with functions like <i>Math.pow(x,y)<\/i>, because of the Javascript language interpretation of the &#8220;.&#8221;, unfortunately<\/font> &#8230; was to take the (old) <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/ology_chalkboard.html_GETME\" title=\"ology_chalkboard.html\">ology_chalkboard.html<\/a> of <a title='Suffix Ology Primer Tutorial' href='#sopt'>Suffix Ology Primer Tutorial<\/a> as shown below, from some days back, and have it be virtually untouched apart from the inclusion of the external Javascript call &#8230;<\/p>\n<p><code><br \/>\n&lt;script type='text\/javascript' src='dotdotdot.js' defer&gt;&lt;\/script&gt;<br \/>\n<\/code><\/p>\n<p> &#8230; that did end up making it into the reworked <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/ology_chalkboard.html-GETME\" title=\"ology_chalkboard.html\">ology_chalkboard.html<\/a> but as the task of overloading (or overriding) the function &#8230;<\/p>\n<p><code><br \/>\nvar userinput = <a target=_blank title='Javascript window.prompt information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/met_win_prompt.asp'>prompt<\/a>([the prompt], [the default value]);<br \/>\n<\/code><\/p>\n<p> &#8230; turned into reality &#8220;reworked&#8221; may not be a descriptive enough term.  We started down the route of a child HTML iframe piece of HTML calling the Javascript native <i>prompt([the prompt], [the default value])<\/i> while the parent did the overloading (or overriding), but as the timing of events got involved the &#8220;dream&#8221; was modified to lose its cute, generic flavour &#8230; but it was achieved, and we used <a target=_blank title='jQuery UI Dialog' href='https:\/\/jqueryui.com\/dialog\/'>jQuery UI Dialog<\/a> techniques to end up with what we ended up with, and which you can read about, also, at this blog, at <a target=_blank title='jQuery UI Modal Dialog Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/jquery-ui-modal-dialog-primer-tutorial\/'>jQuery UI Modal Dialog Primer Tutorial<\/a>.  Please note, though, that the original HTML source code calls that involved <i>var blah=prompt[prompt blah],[default blah])<\/i> &#8230; looking like &#8230; <\/p>\n<p><code><br \/>\nfunction addsome() {<br \/>\n  var two=\"\", three=\"\", <b>one=prompt(\"Enter first of your Suffix Ology parts (adjust accordingly)\", \"ology\");<\/b><br \/>\n  if (one != \"\") {<br \/>\n   \/\/ more here originally and much more, and reworked, with latest version<br \/>\n  }<br \/>\n}<br \/>\n<\/code><\/p>\n<p> &#8230; remain in the code as these calls (but now plus quite a few more), that the parent HTML code overloads (or overrides) via <i>dotdotdot.js<\/i> including our new <i>prompt.js<\/i> via &#8230; <\/p>\n<p><code><br \/>\nvar head= document.getElementsByTagName('head')[0]; \/\/ thanks to http:\/\/unixpapa.com\/js\/dyna.html<br \/>\nvar script= document.createElement('script');<br \/>\nscript.type= 'text\/javascript';<br \/>\nscript.src= 'prompt.js';  \/\/ our window.prompt function override technique<br \/>\nhead.appendChild(script);<br \/>\n<\/code><\/p>\n<p> &#8230; and, as it says in the code, we thank this <a target=_blank title='Useful link' href='http:\/\/unixpapa.com\/js\/dyna.html'>useful link<\/a> for the help here.<\/p>\n<p>Being as we involved jQuery UI Dialogs we figured why not add some design &#8220;smarts&#8221; to our new home styled <i>prompt()<\/i> &#8220;windows&#8221;, so as well as the usual &#8220;Cancel&#8221; and &#8220;OK&#8221; buttons of the native Javascript <i>prompt()<\/i> windows we add &#8220;Will Append More in 5&#8221; and &#8220;Will Append More in 30&#8221; allowances to append user input to the same user input.  So the &#8220;bottom line&#8221; is that our new HTML calls <i>prompt()<\/i> via its external Javascript&#8217;s <i>prompt.js<\/i> as per &#8230;<\/p>\n<p><code><br \/>\nfunction prompt(q,d) {<br \/>\n  \/\/ lots of code before the \"disastrous return\" scenario way below<br \/>\n<b><\/b><br \/>\n  \/\/ end of lots of code before the \"disastrous return\" scenario just below<br \/>\n  return '';<br \/>\n}<br \/>\n<\/code><\/p>\n<p> &#8230; which you can examine at &#8230; <\/p>\n<ul>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/prompt.js_GETME\" title=\"prompt.js\">prompt.js<\/a> is &#8220;child&#8221; external Javascript called by &#8230;<\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/dotdotdot.js_GETME\" title=\"dotdotdot.js\">dotdotdot.js<\/a> is &#8220;parent&#8221; external Javascript called by &#8230;<\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/ology_chalkboard.html-GETME\" title=\"ology_chalkboard.html\">ology_chalkboard.html<\/a> HTML programming source code changed from previous times as per <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/ology_chalkboard.html-GETME\" title=\"ology_chalkboard.html\">this link<\/a><\/li>\n<\/ul>\n<p> &#8230; and which you can try live runs at &#8230; <\/p>\n<ul>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/ology_chalkboard.html\" title=\"ology_chalkboard.html\">live run<\/a> with Javascript <i>prompt()<\/i> overloaded (or overridden) &#8230; versus &#8230;<\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/ology_chalkboard.htm\" title=\"ology_chalkboard.htm\">live run<\/a> the old way<\/li>\n<\/ul>\n<p> &#8230; and for those simple encodeURI(Component) examples &#8230; &#8230; <\/p>\n<ul>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/encodeURIComponent.htm_GETME\" title=\"encodeURIComponent.htm\">encodeURIComponent.htm<\/a> is Javascript overloading <i>encodeURIComponent<\/i> (mapped to <i>encodeURI<\/i>) parent of the child HTML iframe &#8230;<\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/encodeURIComponent.html_GETME\" title=\"encodeURIComponent.html\">encodeURIComponent.html<\/a> calling Javascript native <i>encodeURIComponent<\/i><\/li>\n<\/ul>\n<p> &#8230; and which you can try live runs at &#8230; <\/p>\n<ul>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/encodeURIComponent.htm\" title=\"encodeURIComponent.htm\">live run<\/a> with Javascript <i>encodeURIComponent()<\/i> overloaded (or overridden) (both) results shown &#8230; versus &#8230;<\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/encodeURIComponent.html\" title=\"encodeURIComponent.html\">live run<\/a> only showing the Javascript native <i>encodeURIComponent<\/i> call result<\/li>\n<\/ul>\n<p>We really hope this is food for thought for your Javascript client side coding.<\/p>\n<hr>\n<p id='sopt'>Previous relevant <a target=_blank title='Suffix Ology Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/suffix-ology-primer-tutorial\/'>Suffix Ology Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/ology_chalkboard.html\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"Suffix Ology Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/ology_chalkboard.jpg\" title=\"Suffix Ology Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Suffix Ology Primer Tutorial<\/p><\/div>\n<p>A lot of nouns in English related to &#8220;the study of&#8221; have the suffix &#8220;ology&#8221;.  So, today, we team up the wonderful <a target=_blank href='http:\/\/chemistry.about.com\/od\/mathsciencefundamentals\/a\/ologylist_3.htm' title='List of (sciencific) nouns with suffix ology'>list<\/a> of mainly scientific nouns that have a suffix of &#8220;ology&#8221; (thanks) with the HTML <a target=_blank title='HTML Canvas element information from w3schools' href='http:\/\/www.w3schools.com\/tags\/ref_canvas.asp'>canvas<\/a> element as one of the methods of display for our web application.  A new alternative mode of user questioning via HTML input type=button via the use of the HTML element <a target=_blank title='HTML alt attribute information from w3schools'><i>alt<\/i><\/a> attribute (to shield the answer from a user hovering over the button) is introduced into the &#8220;mix&#8221; today.<\/p>\n<p>This rather technical word and sentence game could help <a target=_blank title='ESL information from Wikipedia' href='http:\/\/en.wikipedia.org\/wiki\/English_as_a_second_or_foreign_language'>ESL<\/a> students, but in all likelihood could benefit native English speakers as well.<\/p>\n<p>So today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/ology_chalkboard.html\" title=\"Click picture\">live run<\/a> based on HTML and Javascript programming code you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/ology_chalkboard.html_GETME\" title=\"ology_chalkboard.html\">ology_chalkboard.html<\/a> incorporates that Translate and Hear functionality using the great <a target=_blank title='Google Translate' href='http:\/\/translate.google.com'>Google Translate<\/a> product that we talked about previously below with <a title='Google Translate English Phrasal Verbs and Idioms Tutorial' href='#gtepvait'>Google Translate English Phrasal Verbs and Idioms Tutorial<\/a> is shown below.<\/p>\n<hr>\n<p id='gtepvait'>Previous relevant <a target=_blank title='Google Translate English Phrasal Verbs and Idioms Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/google-translate-english-phrasal-verbs-and-idioms-tutorial\/'>Google Translate English Phrasal Verbs and Idioms Tutorial<\/a> as shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/englishexpressions_chalkboard.html\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"Google Translate English Phrasal Verbs and Idioms Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/englishexpressionschalkboard.jpg\" title=\"Google Translate English Phrasal Verbs and Idioms Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Google Translate English Phrasal Verbs and Idioms Tutorial<\/p><\/div>\n<p>A couple of our recent <a target=_blank title='ESL information from Wikipedia' href='http:\/\/en.wikipedia.org\/wiki\/English_as_a_second_or_foreign_language'>ESL<\/a> tutorials regarding Phrasal Verbs (<a target=_blank title='English Expressions and Idioms Game Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/english-phrasal-verb-game-primer-tutorial\/'>English Phrasal Verb Game Primer Tutorial<\/a>) and English Expressions and Idioms (as with <a title='English Expressions and Idioms Game Primer Tutorial' href='#eeaigpt'>English Expressions and Idioms Game Primer Tutorial<\/a> below) have a lot in common, especially their capacity to baffle a non-native English speaker.<\/p>\n<p>With this in mind we introduce some new optional functionality that may help out an ESL student completely flummoxed with a Phrasal Verb or an English Expression or Idiom by using Google Translate to translate the phrase or idiom back to their mother tongue.  Obviously, this translation could well be imperfect, but it is designed with a view to the user having no idea where to start understanding the English presented to them.<\/p>\n<p>And so we &#8220;house&#8221; this new functionality in some external Javascript which was <i>almost<\/i> okay to just plug into our two other HTML <i>parents<\/i> but not quite.<\/p>\n<p>Maybe you wonder how it can get even close?  Glad you asked &#8230; well, we like to add external Javascript and design it as independently as possible, so that it can be called by either method below, the latter being an address bar URL and the former being in the HTML&#8217;s <i>head<\/i> section, to become <b>active<\/b> &#8230;<\/p>\n<ol>\n<li><code>&lt;script src='translate_hear.js<b>?translate_hear=yes<\/b>' type='text\/javascript'&gt;&lt;\/script&gt;<\/code><\/li>\n<li><code>http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/englishexpressions_chalkboard.html<b>?translate_hear=yes<\/b><\/code><\/li>\n<\/ol>\n<p> &#8230; and only once this is established, the independently minded external Javascript looks for <i>&gt;.&lt;\/a&gt;<\/i> within <i>document.body.innerHTML<\/i> &#8230; I mean, who&#8217;d be crazy enough to have a link to a dot (.) &#8230; oops! &#8230; anyway &#8230;<\/p>\n<p> &#8230; then we store away (in global var<font size=1>iable<\/font> <i>alist<\/i>&#8216;s global var<font size=1>iable<\/font> alistone) the object of this HTML <i>a<\/i> tag in the external Javascript&#8217;s list of HTML <i>a<\/i> tag elements it derived via &#8230;<\/p>\n<p><code><br \/>\nalist=document.getElementsByTagName('a');<br \/>\n<\/code><\/p>\n<p>We like what happens next.  We are mostly familiar with an HTML <i>a<\/i> tag having the <i>href<\/i> property be a navigation destination, or then perhaps extra functionality that gets executed with the <i>onclick<\/i> event.  Well, we don&#8217;t want to meddle with whatever happens with this &#8230; remember our <i>independently minded<\/i> external Javascript?  Well, we only ask that the parent doesn&#8217;t also define any functionality for the <i>onmousedown<\/i> event, which we want to &#8220;purloin&#8221; (is that the word?) into action for us.  Here&#8217;s our definition of what to do with that dot (yes, <u>.<\/u>) HTML <i>a<\/i> element&#8217;s <i>onmousedown<\/i> event &#8230;<\/p>\n<p><code><br \/>\n            alist[alistone].addEventListener('mousedown', function(event) {<br \/>\n               var xt=document.getElementById('xtranslate');<br \/>\n               var xh=document.getElementById('xhear');<br \/>\n               if (xt && xh && alistone &gt;= 0) {<br \/>\n                 var thishref=alist[alistone].href;<br \/>\n                 var thishparts=thishref.split('\/');<br \/>\n                 if (thishparts.length &gt;= 2) {<br \/>\n                  var thewordsare=thishparts[eval(-1 + thishparts.length)].replace(\/\\+\/g, '%20');<br \/>\n                  if (xt.checked && lto.replace('en','') != '') {<br \/>\n                   urlone='https:\/\/transl' + 'ate.google.com\/#' + lfrom + '\/' + lto + '\/' + thewordsare; \/\/, '_blank', 'top=30,left=30,width=300,height=300');<br \/>\n                   setTimeout(inawhileone, 2100);<br \/>\n                  }<br \/>\n                  if (xh.checked && lto != '') {<br \/>\n                   urltwo='https:\/\/tra' + 'nslate.google.com\/translate_tts?tl=' + lto + '&q=' + thewordsare; \/\/, '_blank', 'top=30,left=330,width=300,height=300');<br \/>\n                   setTimeout(inawhiletwo, 2300);<br \/>\n                  }<br \/>\n                 }<br \/>\n               }<br \/>\n             }, false);<br \/>\n<\/code><\/p>\n<p> &#8230; where the <i>xtranslate<\/i> and <i>xhear<\/i> ID&#8217;ed elements are (HTML type=)checkboxes for user defined <i>Translate<\/i> and <i>Hear<\/i> optional extra active functionality decisions, with reference to global var<font size=1>iable<\/font> <i>lto<\/i> which contains the Google Translate language code for the destination language of the user&#8217;s choice (from a dropdown list, the contents of which we frequently use through the www.rjmprogramming.com.au domain).<\/p>\n<p>So we must thank Google for their great <a target=_blank title='Google Translate' href='http:\/\/translate.google.com'>Google Translate<\/a> product, but, again, caution the user into thinking such translations are always sensibly &#8220;translatable&#8221; between languages.  Again, we stress, this new functionality should just be an aid to the desperate ESL student with little idea about some English presented to them.<\/p>\n<p>Again, we make use of Javascript <a target=_blank title='Javascript setTimeout information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/met_win_settimeout.asp'><i>setTimeout<\/i><\/a> &#8220;scheduled&#8221; Javascript function controller mechanism.  We find it endlessly useful, especially with events in ever changing platform environments.<\/p>\n<p>And so the two pieces of HTML and Javascript affected are &#8230;<\/p>\n<ol>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/englishexpressions_chalkboard.html\" title=\"English Expression and Idiom Game\">Game<\/a> you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/englishexpressions_chalkboard.html-GETME\" title='englishexpressions_chalkboard.html'>englishexpressions_chalkboard.html<\/a> (changed in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/englishexpressions_chalkboard.html-GETME\" title='englishexpressions_chalkboard.html'>this way<\/a>) uses HTML and Javascript programming languages with this <a target=_blank title=\"live run\" href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/englishexpressions_chalkboard.html\">live run<\/a> link<\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/phrasalverbs_chalkboard.html\" title=\"English Expression and Idiom Game\">Game<\/a> you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/phrasalverbs_chalkboard.html-GETME\" title='phrasalverbs_chalkboard.html'>phrasalverbs_chalkboard.html<\/a> (changed in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/phrasalverbs_chalkboard.html-GETME\" title='phrasalverbs_chalkboard.html'>this way<\/a>) uses HTML and Javascript programming languages with this <a target=_blank title=\"live run\" href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/phrasalverbs_chalkboard.html\">live run<\/a> link<\/li>\n<\/ol>\n<p> &#8230; both calling our new external Javascript you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/translate_hear.js_GETME\" title=\"translate_hear.js\">translate_hear.js<\/a> with new optional <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/englishexpressionschalkboard.jpg\">functionality<\/a> <i>Translate<\/i> and\/or <i>Hear<\/i> some baffling English in an ESL student&#8217;s native tongue, perhaps.<\/p>\n<hr>\n<p id='eeaigpt'>Previous relevant <a target=_blank title='English Expressions and Idioms Game Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/english-expressions-and-idioms-game-primer-tutorial\/'>English Expressions and Idioms Game Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/englishexpressions_chalkboard.html\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"English Expressions and Idioms Game Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/englishexpressions_chalkboard.jpg\" title=\"English Expressions and Idioms Game Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">English Expressions and Idioms Game Primer Tutorial<\/p><\/div>\n<p>Advanced <a target=_blank title='ESL information from Wikipedia' href='http:\/\/en.wikipedia.org\/wiki\/English_as_a_second_or_foreign_language'>ESL<\/a> students are on the lookout for ways to &#8220;turbo charge&#8221; their improvement of English by being able to understand some of the English Expressions and <a target=_blank title='Idiom information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Idiom'>Idioms<\/a> an English native speaker is quite likely to take for granted &#8230; and so, alas, for the ESL beginner, is quite likely to slip into their conversational English.<\/p>\n<p>Today we present a missing part of one of these English Expressions or Idioms and get the user to try to fill in the missing part.<\/p>\n<p>Today we&#8217;d like to thank <a target=_blank title='Useful link' href='http:\/\/www.smart-words.org\/quotes-sayings\/idioms-meaning.html'>this link<\/a> for a great list of English expressions and idioms (thanks for the list and you can find an explanation of the meanings at this link too) and, as per usual with ESL games (here at this blog), <a target=_blank title='Free Dictionary' href='http:\/\/www.thefreedictionary.com'>The Free Dictionary<\/a> for the English expression or idiom lookups that may help linked off the underlined dot.  Also of great help was the advice regarding Linear Gradient backgrounds for our HTML5 canvas element used today, that came from this very very <a target=_blank title='Useful link regarding addColorStop canvas element from w3schools' href='http:\/\/www.w3schools.com\/tags\/canvas_addcolorstop.asp'>useful link<\/a>.<\/p>\n<p>This <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/englishexpressions_chalkboard.html\" title=\"English Expression and Idiom Game\">game<\/a> you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/englishexpressions_chalkboard.html_GETME\" title='englishexpressions_chalkboard.html'>englishexpressions_chalkboard.html<\/a> uses HTML and Javascript programming languages.  Hopefully you can figure the rules when you click the picture above for a <a target=_blank title=\"live run\" href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/englishexpressions_chalkboard.html\">live run<\/a>.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d20537' onclick='var dv=document.getElementById(\"d20537\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/esl\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d20537' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d20578' onclick='var dv=document.getElementById(\"d20578\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/javascript\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d20578' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d20887' onclick='var dv=document.getElementById(\"d20887\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/canvas\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d20887' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d20921' onclick='var dv=document.getElementById(\"d20921\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/overload\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d20921' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Today&#8217;s blog posting, long in the making, is about Javascript&#8217;s function override (or overload) capabilities. We&#8217;ve spoken about this before in relation to C++ or Java with these tutorials. So let&#8217;s do a simple example first. Take the Javascript global &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/javascript-function-overload-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,13,14,15,37],"tags":[184,396,409,476,477,576,578,652,663,1837,1836,997,1119,1319,1452],"class_list":["post-20921","post","type-post","status-publish","format-standard","hentry","category-elearning","category-esl","category-event-driven-programming","category-games","category-tutorials","tag-canvas","tag-esl","tag-external-javascript","tag-game","tag-games-2","tag-html","tag-html5","tag-javascript","tag-jquery","tag-overload","tag-override","tag-programming","tag-sentence","tag-tutorial","tag-word"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/20921"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=20921"}],"version-history":[{"count":11,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/20921\/revisions"}],"predecessor-version":[{"id":20937,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/20921\/revisions\/20937"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=20921"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=20921"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=20921"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}