{"id":16559,"date":"2009-02-14T05:01:30","date_gmt":"2009-02-13T23:31:30","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/"},"modified":"2009-02-14T05:01:30","modified_gmt":"2009-02-13T23:31:30","slug":"solved-explain-the-javascript","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/","title":{"rendered":"[Solved] Explain the javascript"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-63241878\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"63241878\" data-parentid=\"63241466\" data-score=\"2\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<p>This looks a bit like minimised code, where function call are often shortened by creating lookup tables, so you can save some bits on long function calls like <code>Element.dispatchEvent<\/code> and instead minimise it to <code>e[l(p)]<\/code>.<\/p>\n<p>The variable <code>_0x76ed32<\/code> holds the reference to your input element.<\/p>\n<pre><code>_0x76ed32['dispatchEvent'](new Event('blur'))\n<\/code><\/pre>\n<p>This is a function call on your element. It is equivalent to the usual notation you see:<\/p>\n<pre><code>_0x76ed32.dispatchEvent(new Event('blur'))\n<\/code><\/pre>\n<p>meaning it simply dispatches the blur event. This method to write a function call is typical if you don&#8217;t know the name of the function and it&#8217;s decided at runtime, e.g.<\/p>\n<pre><code>let func=\"dispatchEvent\";\n_0x76ed32[func](new Event('blur'))\n<\/code><\/pre>\n<p>Look up &#8220;reflection&#8221; to learn more about this.<\/p>\n<p>The following code snippet is a good example for this:<\/p>\n<pre><code>a0_0x3fed('0x9f')\n<\/code><\/pre>\n<p>returns a function name which is then plugged into the following function call<\/p>\n<pre><code>$(_0x76ed32)[a0_0x3fed('0x9f')](a0_0x3fed('0x3b'), _0x5bf4db)\n<\/code><\/pre>\n<p>I assume it is setting the value of the input element <code>_0x76ed32<\/code>, but why the element is being wrapped <code>$(_0x76ed32)<\/code> and what the two function parameters are, cannot be told from just this line of code.<br \/>\nI assume it&#8217;s similar to the native <code>setAttribute(name,value)<\/code> call.<\/p>\n<p>and lastly you have the following code snippet:<\/p>\n<pre><code>_0x76ed32[a0_0x3fed('0xb3')](new Event('input'))\n<\/code><\/pre>\n<p>Here, <code>a0_0x3fed('0xb3')<\/code> again returns a function name. From inspecting the call, it&#8217;s most likely <code>dispatchEvent<\/code>, which then dispatches the <code>input<\/code> event on the element <code>_0x76ed32<\/code>.<\/p>\n<p>It might work something like this:<\/p>\n<\/p>\n<div class=\"snippet\" data-lang=\"js\" data-hide=\"false\" data-console=\"true\" data-babel=\"false\">\n<div class=\"snippet-code\">\n<pre class=\"snippet-code-js lang-js prettyprint-override\"><code>let _0x76ed32 = document.querySelector(\"input\"),\n  fields = {\n    '0xb3': \"dispatchEvent\",\n    '0x3b': \"value\",\n    '0x9f': \"setAttribute\"\n  },\n  a0_0x3fed = par =&gt; fields[par],\n  _0x5bf4db = \"new value :)\";\n  \n\/\/ slightly changed the code\n_0x76ed32[a0_0x3fed('0xb3')](new Event('input'));\n_0x76ed32[a0_0x3fed('0x9f')](a0_0x3fed('0x3b'), _0x5bf4db);\n_0x76ed32[a0_0x3fed('0xb3')](new Event('blur'));<\/code><\/pre>\n<pre class=\"snippet-code-html lang-html prettyprint-override\"><code>&lt;input type=\"text\" value=\"old value!\" \/&gt;<\/code><\/pre>\n<\/div>\n<\/div>\n<p>Final note: Your code should work perfectly fine, once you emit the events in the right order:<\/p>\n<\/p>\n<div class=\"snippet\" data-lang=\"js\" data-hide=\"false\" data-console=\"true\" data-babel=\"false\">\n<div class=\"snippet-code\">\n<pre class=\"snippet-code-js lang-js prettyprint-override\"><code>var elem = document.getElementById('mobile');\nelem.value=\"1234567890\";\nelem.dispatchEvent(new Event('blur', { bubbles: true }));\nelem.dispatchEvent(new Event('input', { bubbles: true }));<\/code><\/pre>\n<pre class=\"snippet-code-html lang-html prettyprint-override\"><code>&lt;input id=\"mobile\" type=\"text\" value=\"123\" \/&gt;<\/code><\/pre>\n<\/div>\n<\/div><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\">1<\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved Explain the javascript <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] This looks a bit like minimised code, where function call are often shortened by creating lookup tables, so you can save some bits on long function calls like Element.dispatchEvent and instead minimise it to e[l(p)]. The variable _0x76ed32 holds the reference to your input element. _0x76ed32[&#8216;dispatchEvent&#8217;](new Event(&#8216;blur&#8217;)) This is a function call on your &#8230; <a title=\"[Solved] Explain the javascript\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/\" aria-label=\"More on [Solved] Explain the javascript\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[333],"class_list":["post-16559","post","type-post","status-publish","format-standard","hentry","category-solved","tag-javascript"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Solved] Explain the javascript - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] Explain the javascript - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] This looks a bit like minimised code, where function call are often shortened by creating lookup tables, so you can save some bits on long function calls like Element.dispatchEvent and instead minimise it to e[l(p)]. The variable _0x76ed32 holds the reference to your input element. _0x76ed32[&#039;dispatchEvent&#039;](new Event(&#039;blur&#039;)) This is a function call on your ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2009-02-13T23:31:30+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] Explain the javascript\",\"datePublished\":\"2009-02-13T23:31:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/\"},\"wordCount\":230,\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"keywords\":[\"javascript\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/\",\"url\":\"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/\",\"name\":\"[Solved] Explain the javascript - JassWeb\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#website\"},\"datePublished\":\"2009-02-13T23:31:30+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/jassweb.com\/solved\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] Explain the javascript\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/jassweb.com\/solved\/#website\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/jassweb.com\/solved\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"contentUrl\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750\",\"contentUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\/\/jassweb.com\"],\"url\":\"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] Explain the javascript - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] Explain the javascript - JassWeb","og_description":"[ad_1] This looks a bit like minimised code, where function call are often shortened by creating lookup tables, so you can save some bits on long function calls like Element.dispatchEvent and instead minimise it to e[l(p)]. The variable _0x76ed32 holds the reference to your input element. _0x76ed32['dispatchEvent'](new Event('blur')) This is a function call on your ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/","og_site_name":"JassWeb","article_published_time":"2009-02-13T23:31:30+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] Explain the javascript","datePublished":"2009-02-13T23:31:30+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/"},"wordCount":230,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["javascript"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/","url":"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/","name":"[Solved] Explain the javascript - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2009-02-13T23:31:30+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-explain-the-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] Explain the javascript"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/16559","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=16559"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/16559\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=16559"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=16559"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=16559"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}