{"id":3971,"date":"2018-04-01T10:21:53","date_gmt":"2018-04-01T08:21:53","guid":{"rendered":"https:\/\/monodes.com\/predaelli\/?p=3971"},"modified":"2018-04-01T10:21:53","modified_gmt":"2018-04-01T08:21:53","slug":"sheer-pure-evil","status":"publish","type":"post","link":"https:\/\/monodes.com\/predaelli\/2018\/04\/01\/sheer-pure-evil\/","title":{"rendered":"Sheer, pure evil"},"content":{"rendered":"<h1><em><a href=\"https:\/\/codeburst.io\/javascript-can-a-1-a-2-a-3-ever-evaluate-to-true-aca13ff4462d\"><\/a><a href=\"https:\/\/codeburst.io\/javascript-can-a-1-a-2-a-3-ever-evaluate-to-true-aca13ff4462d\"><img data-recalc-dims=\"1\" decoding=\"async\" class=\"alignnone size-full\" src=\"https:\/\/i0.wp.com\/cdn-images-1.medium.com\/max\/1200\/1%2AKQzP0-s4E2-Zi6Xda-oICg.png?w=910&#038;ssl=1\" alt=\"\" \/><\/a><a href=\"https:\/\/codeburst.io\/javascript-can-a-1-a-2-a-3-ever-evaluate-to-true-aca13ff4462d\">JavaScript: Can (a==1 &amp;&amp; a==2 &amp;&amp; a==3) ever evaluate to true?\u00a0Yes, it can. Understand how in this article!<\/a><\/em><\/h1>\n<p>That&#8217;s pure sheer evil, in my humble opinion as it tricks most people. Eiffel forbids this evilness, but I shall explain it better.<\/p>\n<p><!--more--><\/p>\n<p><!--nextpage--><\/p>\n<blockquote>\n<p id=\"6790\" class=\"graf graf--p graf-after--figure\">Recently, an interesting code snippet has been making the rounds on <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/twitter.com\/hugojmd\/status\/953763304958255105\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/twitter.com\/hugojmd\/status\/953763304958255105\">Twitter<\/a> and <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/www.reddit.com\/r\/javascript\/comments\/7r0i00\/can_a_1_a_2_a3_ever_evaluate_to_true\/\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/www.reddit.com\/r\/javascript\/comments\/7r0i00\/can_a_1_a_2_a3_ever_evaluate_to_true\/\">Reddit<\/a>.<\/p>\n<ul class=\"postList\">\n<li id=\"3eef\" class=\"graf graf--li graf-after--p\"><strong class=\"markup--strong markup--li-strong\">The question is\u200a<\/strong>\u2014\u200aCan <code class=\"\" data-line=\"\">(a==1 &amp;&amp; a==2 &amp;&amp; a==3)<\/code> ever evaluate to true?<\/li>\n<li id=\"f18c\" class=\"graf graf--li graf-after--li\"><strong class=\"markup--strong markup--li-strong\">The answer is\u200a<\/strong>\u2014\u200aYes.<\/li>\n<\/ul>\n<figure id=\"26de\" class=\"graf graf--figure graf--iframe graf-after--li\">\n<div class=\"aspectRatioPlaceholder is-locked\"><\/div>\n<\/figure>\n<section class=\"section section--body section--first\">\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<figure id=\"26de\" class=\"graf graf--figure graf--iframe graf-after--li\">\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"progressiveMedia js-progressiveMedia is-canvasLoaded is-imageLoaded\" data-scroll=\"native\">\n<div class=\"iframeContainer\"><iframe loading=\"lazy\" class=\"progressiveMedia-iframe js-progressiveMedia-iframe\" src=\"https:\/\/codeburst.io\/media\/9ae9a147ace13fe08962d45d641e8b74?postId=aca13ff4462d\" width=\"500\" height=\"185\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\" data-width=\"500\" data-height=\"185\" data-src=\"\/media\/9ae9a147ace13fe08962d45d641e8b74?postId=aca13ff4462d\" data-media-id=\"9ae9a147ace13fe08962d45d641e8b74\" data-thumbnail=\"https:\/\/i.embed.ly\/1\/image?url=https%3A%2F%2Fpbs.twimg.com%2Fmedia%2FDTxylbTW4AA4nnW.png%3Alarge&amp;key=a19fcc184b9711e1b4764040d3dc5c07\" data-mce-fragment=\"1\"><\/iframe><\/div>\n<\/div>\n<\/div>\n<\/figure>\n<p id=\"bf50\" class=\"graf graf--p graf-after--figure\">In this article we\u2019ll examine this code and why it works:<\/p>\n<pre id=\"ae8c\" class=\"graf graf--pre graf-after--p\">const a = {\n  num: 0,\n  valueOf: function() {\n    return this.num += 1\n  }\n};<\/pre>\n<pre id=\"36bc\" class=\"graf graf--pre graf-after--pre\">const equality = (a==1 &amp;&amp; a==2 &amp;&amp; a==3);<\/pre>\n<pre id=\"d3d6\" class=\"graf graf--pre graf-after--pre\">console.log(equality); \/\/ true<\/pre>\n<p id=\"0379\" class=\"graf graf--p graf-after--pre graf--trailing\">If you\u2019re using Google Chrome, open up your developer console with [<em class=\"markup--em markup--p-em\">windows<\/em>]: <strong class=\"markup--strong markup--p-strong\">Ctrl + Shift + J<\/strong> [<em class=\"markup--em markup--p-em\">mac<\/em>]: <strong class=\"markup--strong markup--p-strong\">Cmd + Opt + J<\/strong><\/p>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body section--last\">\n<div class=\"section-divider\">\n<hr class=\"section-divider\" \/>\n<\/div>\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<h3 id=\"ebb8\" class=\"graf graf--h3 graf--leading\">What\u2019s the\u00a0trick?<\/h3>\n<p id=\"d1f9\" class=\"graf graf--p graf-after--h3\">There really isn\u2019t one. This code simply takes advantage of two basic JavaScript concepts:<\/p>\n<ul class=\"postList\">\n<li id=\"4e05\" class=\"graf graf--li graf-after--p\">Loose Equality<\/li>\n<li id=\"cb09\" class=\"graf graf--li graf-after--li\">An object\u2019s <code class=\"\" data-line=\"\">valueOf()<\/code> function<\/li>\n<\/ul>\n<h4 id=\"f398\" class=\"graf graf--h4 graf-after--li\"><strong class=\"markup--strong markup--h4-strong\">Loose Equality<\/strong><\/h4>\n<p id=\"fdd4\" class=\"graf graf--p graf-after--h4\">Notice that the equation we\u2019re testing: <code class=\"\" data-line=\"\">(a==1 &amp;&amp; a==2 &amp;&amp; a==3)<\/code>, uses loose equality. This means type coercion will be preformed and we can be a little less precise than we need to be. Since I\u2019ve already done numerous articles on loose equality, I wont go into it here. If you need a refresher on loose quality, read my previous article: <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/codeburst.io\/javascript-double-equals-vs-triple-equals-61d4ce5a121a\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/codeburst.io\/javascript-double-equals-vs-triple-equals-61d4ce5a121a\"><strong class=\"markup--strong markup--p-strong\">JavaScript\u200a\u2014\u200aDouble Equals vs. Triple Equals<\/strong><\/a><strong class=\"markup--strong markup--p-strong\">.<\/strong><\/p>\n<h4 id=\"63c9\" class=\"graf graf--h4 graf-after--p\">valueOf<\/h4>\n<p id=\"d11f\" class=\"graf graf--p graf-after--h4\">JavaScript provides a built in method to convert an object into a primitive value: <code class=\"\" data-line=\"\">Object.prototype.valueOf()<\/code>. By default this method returns the object it is being called on.<\/p>\n<p id=\"7ef3\" class=\"graf graf--p graf-after--p\">Lets create an object:<\/p>\n<pre id=\"51b9\" class=\"graf graf--pre graf-after--p\">const a = {\n  num: 0\n}<\/pre>\n<p id=\"9143\" class=\"graf graf--p graf-after--pre\">As explained above, when we call <code class=\"\" data-line=\"\">valueOf()<\/code> on our <code class=\"\" data-line=\"\">a<\/code> object, it simply returns the object:<\/p>\n<pre id=\"21fd\" class=\"graf graf--pre graf-after--p\">a.valueOf();<\/pre>\n<pre id=\"eb79\" class=\"graf graf--pre graf-after--pre\">\/\/ {num: 0}<\/pre>\n<p id=\"9fd0\" class=\"graf graf--p graf-after--pre\">Cool! We can also use <code class=\"\" data-line=\"\">typeof<\/code> to verify an object is being returned:<\/p>\n<pre id=\"0a15\" class=\"graf graf--pre graf-after--p\">typeof a.valueOf();<\/pre>\n<pre id=\"b8c9\" class=\"graf graf--pre graf-after--pre\">\/\/ \"object\"<\/pre>\n<p id=\"9cd2\" class=\"graf graf--p graf-after--pre\">But the real fun with <code class=\"\" data-line=\"\">valueOf()<\/code> is that we can overwrite it in order to convert an object into a primitive value. In other words, we can use <code class=\"\" data-line=\"\">valueOf<\/code> to return a string, number, boolean, etc. instead of an object. Take a look at the code below:<\/p>\n<pre id=\"61f1\" class=\"graf graf--pre graf-after--p\">a.valueOf = function() {\n  return this.num;\n}<\/pre>\n<p id=\"92fb\" class=\"graf graf--p graf-after--pre\">What we\u2019ve done is overwritten the native code within <code class=\"\" data-line=\"\">valueOf()<\/code> for the <code class=\"\" data-line=\"\">a<\/code> object. <code class=\"\" data-line=\"\">valueOf()<\/code> will now return the value of <code class=\"\" data-line=\"\">a.num<\/code> when it is called.<\/p>\n<p id=\"7e10\" class=\"graf graf--p graf-after--p\">This means if we now call the function:<\/p>\n<pre id=\"ec20\" class=\"graf graf--pre graf-after--p\">a.valueOf();<\/pre>\n<pre id=\"a78b\" class=\"graf graf--pre graf-after--pre\">\/\/ 0<\/pre>\n<p id=\"3a30\" class=\"graf graf--p graf-after--pre\">We get <code class=\"\" data-line=\"\">0<\/code>! Which makes sense as <code class=\"\" data-line=\"\">0<\/code> is the value assigned to <code class=\"\" data-line=\"\">a.num<\/code>. We can verify this by running a few tests:<\/p>\n<pre id=\"9fb7\" class=\"graf graf--pre graf-after--p\">typeof a.valueOf();<\/pre>\n<pre id=\"2543\" class=\"graf graf--pre graf-after--pre\">\/\/ \"number\"<\/pre>\n<pre id=\"1e87\" class=\"graf graf--pre graf-after--pre\">a.num == a.valueOf()<\/pre>\n<pre id=\"9d63\" class=\"graf graf--pre graf-after--pre\">\/\/ true<\/pre>\n<p id=\"740f\" class=\"graf graf--p graf-after--pre\">Awesome! <strong class=\"markup--strong markup--p-strong\">But why is this important?<\/strong><\/p>\n<p id=\"f833\" class=\"graf graf--p graf-after--p\">It\u2019s important because when you check loose equality with two different <em class=\"markup--em markup--p-em\">types<\/em> of operators, JavaScript will attempt to perform type coercion\u200a\u2014\u200ait will attempt to coerce (convert) the operands into a like\/similar type.<\/p>\n<p id=\"eb0b\" class=\"graf graf--p graf-after--p\">In our equation: <code class=\"\" data-line=\"\">(a==1 &amp;&amp; a==2 &amp;&amp; a==3)<\/code>, JavaScript will attempt to coerce the object <code class=\"\" data-line=\"\">a<\/code> into a number prior to comparing them. <span class=\"markup--quote markup--p-quote is-other\" data-creator-ids=\"anon\"><strong class=\"markup--strong markup--p-strong\">When performing type coercion on an object, JavaScript first attempts to call the <\/strong><code class=\"\" data-line=\"\">valueOf()<\/code><strong class=\"markup--strong markup--p-strong\"> method.<\/strong><\/span><\/p>\n<p id=\"90d5\" class=\"graf graf--p graf-after--p\">Since we\u2019ve altered our <code class=\"\" data-line=\"\">valueOf()<\/code> method above to return <code class=\"\" data-line=\"\">a.num<\/code> which is a number, we can now do the following:<\/p>\n<pre id=\"000b\" class=\"graf graf--pre graf-after--p\">a == 0<\/pre>\n<pre id=\"23b7\" class=\"graf graf--pre graf-after--pre\">\/\/ true<\/pre>\n<p id=\"8da5\" class=\"graf graf--p graf-after--pre\">Holy crap we\u2019ve done it.<\/p>\n<p id=\"778c\" class=\"graf graf--p graf-after--p\"><strong class=\"markup--strong markup--p-strong\"><em class=\"markup--em markup--p-em\">Almost.<\/em><\/strong><\/p>\n<p id=\"1ece\" class=\"graf graf--p graf-after--p\">We now need a way to systematically increase the value of <code class=\"\" data-line=\"\">a<\/code> every time it is called. Luckily, in JavaScript we have the <em class=\"markup--em markup--p-em\">Addition Assignment Operator <\/em>(<code class=\"\" data-line=\"\">+=<\/code>).<\/p>\n<p id=\"8a2b\" class=\"graf graf--p graf-after--p\">The <em class=\"markup--em markup--p-em\">Addition Assignment Operator<\/em> simply adds the value of the right operand to the left variable and assigns the variable with that value. Here\u2019s a simple example:<\/p>\n<pre id=\"c6ad\" class=\"graf graf--pre graf-after--p\">let b = 1<\/pre>\n<pre id=\"bc9b\" class=\"graf graf--pre graf-after--pre\">console.log(b+=1); \/\/ 2\nconsole.log(b+=1); \/\/ 3\nconsole.log(b+=1); \/\/ 4<\/pre>\n<p id=\"3728\" class=\"graf graf--p graf-after--pre\">As you can see, every time we use the <em class=\"markup--em markup--p-em\">Addition Assignment Operator, <\/em>the value of our variable increases! Lets apply this same concept to our <code class=\"\" data-line=\"\">valueOf()<\/code> function:<\/p>\n<pre id=\"38a3\" class=\"graf graf--pre graf-after--p\">a.valueOf = function() {\n  return this.num += 1;\n}<\/pre>\n<p id=\"e18a\" class=\"graf graf--p graf-after--pre\">Instead of just returning <code class=\"\" data-line=\"\">this.num<\/code>, we\u2019re now going to return the value of <code class=\"\" data-line=\"\">this.num<\/code> plus <code class=\"\" data-line=\"\">1<\/code>, each time it is called.<\/p>\n<p id=\"ed65\" class=\"graf graf--p graf-after--p\">With this change made, we can finally run our code:<\/p>\n<pre id=\"ca04\" class=\"graf graf--pre graf-after--p\">const equality = (a==1 &amp;&amp; a==2 &amp;&amp; a==3);<\/pre>\n<pre id=\"473e\" class=\"graf graf--pre graf-after--pre\">console.log(equality); \/\/ true<\/pre>\n<p id=\"4c49\" class=\"graf graf--p graf-after--pre\">It works!<\/p>\n<p id=\"171a\" class=\"graf graf--p graf-after--p\">Remember. With loose equality, JS attempts to coerce type. Our object calls <code class=\"\" data-line=\"\">valueOf()<\/code> which will return <code class=\"\" data-line=\"\">a.num += 1<\/code>, in other words, it returns <code class=\"\" data-line=\"\">a.num<\/code> incrementing by <code class=\"\" data-line=\"\">1<\/code> each time it is called. From here we\u2019re simply comparing two numbers which results in a <code class=\"\" data-line=\"\">true<\/code>. Here\u2019s a breakdown if that helps:<\/p>\n<pre id=\"b9a8\" class=\"graf graf--pre graf-after--p\">a                     == 1   -&gt; \na.valueOf()           == 1   -&gt; \na.num += 1            == 1   -&gt; \n0     += 1            == 1   -&gt;\n1                     == 1   -&gt; <strong class=\"markup--strong markup--pre-strong\">true<\/strong><\/pre>\n<pre id=\"cb64\" class=\"graf graf--pre graf-after--pre\">a                     == 2   -&gt; \na.valueOf()           == 2   -&gt; \na.num += 1            == 2   -&gt; \n1     += 1            == 2   -&gt;\n2                     == 2   -&gt; <strong class=\"markup--strong markup--pre-strong\">true<\/strong><\/pre>\n<pre id=\"0ad6\" class=\"graf graf--pre graf-after--pre\">a                     == 3   -&gt; \na.valueOf()           == 3   -&gt; \na.num += 1            == 3   -&gt; \n2     += 1            == 3   -&gt;\n3                     == 3   -&gt; <strong class=\"markup--strong markup--pre-strong\">true<\/strong><\/pre>\n<h3 id=\"2a10\" class=\"graf graf--h3 graf-after--pre\">Closing Notes:<\/h3>\n<p id=\"865a\" class=\"graf graf--p graf-after--h3\">Thanks for reading! If you\u2019re ready to finally learn Web Development, check out: <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/codeburst.io\/the-ultimate-guide-to-learning-full-stack-web-development-in-6-months-for-30-72b3854a7458\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/codeburst.io\/the-ultimate-guide-to-learning-full-stack-web-development-in-6-months-for-30-72b3854a7458\"><strong class=\"markup--strong markup--p-strong\">The Ultimate Guide to Learning Full Stack Web Development in 6 months<\/strong><\/a>.<\/p>\n<p id=\"daa6\" class=\"graf graf--p graf-after--p\">If you\u2019re working towards becoming a better JavaScript Developer, check out: <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/codeburst.io\/ace-your-javascript-interview-learn-algorithms-data-structures-dabb547fb385\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/codeburst.io\/ace-your-javascript-interview-learn-algorithms-data-structures-dabb547fb385\"><strong class=\"markup--strong markup--p-strong\">Ace Your Javascript Interview\u200a\u2014\u200aLearn Algorithms + Data Structures<\/strong><\/a>.<\/p>\n<p id=\"ba1b\" class=\"graf graf--p graf-after--p\">I publish 4 articles on web development each week. Please consider <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/docs.google.com\/forms\/d\/e\/1FAIpQLSeQYYmBCBfJF9MXFmRJ7hnwyXvMwyCtHC5wxVDh5Cq--VT6Fg\/viewform\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/docs.google.com\/forms\/d\/e\/1FAIpQLSeQYYmBCBfJF9MXFmRJ7hnwyXvMwyCtHC5wxVDh5Cq--VT6Fg\/viewform\"><strong class=\"markup--strong markup--p-strong\">entering your email here<\/strong><\/a> if you\u2019d like to be added to my once-weekly email list, or follow me on <a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/twitter.com\/BrandonMorelli\" target=\"_blank\" rel=\"noopener\" data-href=\"https:\/\/twitter.com\/BrandonMorelli\"><strong class=\"markup--strong markup--p-strong\">Twitter<\/strong><\/a>.<\/p>\n<\/div>\n<\/div>\n<\/section>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\">JavaScript: Can (a==1 &amp;&amp; a==2 &amp;&amp; a==3) ever evaluate to true?\u00a0Yes, it can. Understand how in this article! That&#8217;s pure sheer evil, in my humble opinion as it tricks most people. Eiffel forbids this evilness, but I shall explain it better.<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"https:\/\/monodes.com\/predaelli\/2018\/04\/01\/sheer-pure-evil\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[72,34,50],"tags":[],"class_list":["post-3971","post","type-post","status-publish","format-standard","hentry","category-documentations","category-eiffel","category-javascript"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6daft-123","jetpack-related-posts":[{"id":297,"url":"https:\/\/monodes.com\/predaelli\/2015\/06\/12\/javascript-other-languages\/","url_meta":{"origin":3971,"position":0},"title":"JavaScript + Other Languages","author":"Paolo Redaelli","date":"2015-06-12","format":"link","excerpt":"JavaScript+OtherLanguages Those slides JavaScript + Other Languages are really useful to implement an eventual Eiffel to JavaScript compiler. Well, actually it should be called transcompiler.... We could just feed the C files made by current Liberty compiler but it seems to me that passing throught C which is a procedural\u2026","rel":"","context":"In &quot;Eiffel&quot;","block_context":{"text":"Eiffel","link":"https:\/\/monodes.com\/predaelli\/category\/eiffel\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":9687,"url":"https:\/\/monodes.com\/predaelli\/2022\/10\/01\/spacevim-has-eiffel-support\/","url_meta":{"origin":3971,"position":1},"title":"SpaceVim has Eiffel support!","author":"Paolo Redaelli","date":"2022-10-01","format":false,"excerpt":"SpaceVim, a community-driven vim distribution that seeks to provide layer feature, besides turning Vim into a nifty IDE for several languages (C\/C++, Rust, Kotlin, Go, Python, Java and JavaScript plus others), it offers among the available layers one for Eiffel! \u00a0","rel":"","context":"In &quot;Eiffel&quot;","block_context":{"text":"Eiffel","link":"https:\/\/monodes.com\/predaelli\/category\/eiffel\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2055,"url":"https:\/\/monodes.com\/predaelli\/2017\/01\/06\/exiting-the-ivory-tower\/","url_meta":{"origin":3971,"position":2},"title":"Exiting the ivory tower","author":"Paolo Redaelli","date":"2017-01-06","format":false,"excerpt":"From \"Web Development with Bootstrap 4 and Angular 2 - Second Edition\" In one moment of compilation, a TypeScript compiler can generate a declaration file which contains only signatures of the exported types. The resulting declaration file with the extension .d.ts along with a JavaScript library or module can be\u2026","rel":"","context":"In &quot;Eiffel&quot;","block_context":{"text":"Eiffel","link":"https:\/\/monodes.com\/predaelli\/category\/eiffel\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4677,"url":"https:\/\/monodes.com\/predaelli\/2018\/10\/22\/conditional-javascript-for-experts-hacker-noon\/","url_meta":{"origin":3971,"position":3},"title":"Conditional JavaScript for Experts \u2013 Hacker Noon","author":"Paolo Redaelli","date":"2018-10-22","format":false,"excerpt":"Mastery of conditional expressions for cleaner codes They say in Conditional JavaScript for Experts \u2013 Hacker Noon. What they are suggesting is to use side-effects of\u00a0 \"expression\", as Javascript does not separate commands and queries. Call me dogmatic but this behavior to look like a fundamental ingredient for disaster. In\u2026","rel":"","context":"In &quot;Eiffel&quot;","block_context":{"text":"Eiffel","link":"https:\/\/monodes.com\/predaelli\/category\/eiffel\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":9080,"url":"https:\/\/monodes.com\/predaelli\/2022\/01\/23\/javascript-insanity\/","url_meta":{"origin":3971,"position":4},"title":"Javascript insanity?","author":"Paolo Redaelli","date":"2022-01-23","format":false,"excerpt":"On Facebook\u00a0they write I enjoy JavaScript but this is insanity Welcome to a language that has approximate math as the only math you can use. In fact 7110 \/ 100 * 100 is 7109.99999999 because the first division cannot be exactly represented with with a floating point representation. Sites like\u2026","rel":"","context":"In &quot;Fun&quot;","block_context":{"text":"Fun","link":"https:\/\/monodes.com\/predaelli\/category\/fun\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2022\/01\/javascript-insanity.webp?fit=520%2C372&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":9041,"url":"https:\/\/monodes.com\/predaelli\/2022\/01\/04\/is-the-macos-gui-development-scene-really-this-bad\/","url_meta":{"origin":3971,"position":5},"title":"Is the macOS GUI development scene really this bad?","author":"Paolo Redaelli","date":"2022-01-04","format":false,"excerpt":"Paul WalkerFollow on last summer asked Is the macOS GUI development scene really this bad? That's a question I'm interested in because while I've been using exclusively Linux since 1997 I strive to write portable programs. Most people are still \"shackled\" into proprietary operative systems. He enlist Swift, JavaScript, C#,\u2026","rel":"","context":"In &quot;Senza categoria&quot;","block_context":{"text":"Senza categoria","link":"https:\/\/monodes.com\/predaelli\/category\/senza-categoria\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/3971","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/comments?post=3971"}],"version-history":[{"count":0,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/3971\/revisions"}],"wp:attachment":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/media?parent=3971"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/categories?post=3971"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/tags?post=3971"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}