{"id":7689,"date":"2020-10-17T15:05:25","date_gmt":"2020-10-17T13:05:25","guid":{"rendered":"https:\/\/monodes.com\/predaelli\/?p=7689"},"modified":"2020-10-17T15:05:25","modified_gmt":"2020-10-17T13:05:25","slug":"11-frontend-tricks-that-most-frontend-developers-dont-know-about-by-daniel-anderson-javascript-in-plain-english-oct-2020-medium","status":"publish","type":"post","link":"https:\/\/monodes.com\/predaelli\/2020\/10\/17\/11-frontend-tricks-that-most-frontend-developers-dont-know-about-by-daniel-anderson-javascript-in-plain-english-oct-2020-medium\/","title":{"rendered":"11 Frontend tricks that most Frontend Developers don\u2019t know about | by Daniel Anderson | JavaScript In Plain English | Oct, 2020 | Medium"},"content":{"rendered":"<blockquote><p>Interesting tricks you can do with HTML\/JS\/CSS<\/p><\/blockquote>\n<p>Source: <em><a href=\"https:\/\/medium.com\/javascript-in-plain-english\/11-frontend-tricks-that-most-frontend-developers-dont-know-about-68dc48199ed6\">11 Frontend tricks that most Frontend Developers don\u2019t know about | by Daniel Anderson | JavaScript In Plain English | Oct, 2020 | Medium<\/a><\/em><\/p>\n<p><!--more--><!--nextpage--><\/p>\n<blockquote>\n<div>\n<h1 id=\"3963\" class=\"fe ff fg fh b fi fj fk fl fm fn fo fp fq fr fs ft fu fv fw fx fy fz ga gb gc ce\">11 Frontend tricks that most Frontend Developers don\u2019t know about<\/h1>\n<\/div>\n<h2 id=\"6a20\" class=\"gd ff fg au b ge gf gg gh gi gj gk gl gm gn go gp gq gr gs gt ax\">Interesting tricks you can do with HTML\/JS\/CSS<\/h2>\n<div class=\"gu\">\n<div class=\"n gv gw gx gy\">\n<div class=\"o n\">\n<div>\n<div class=\"cg gz ha\">\n<div class=\"hb n hc o p t hd he hf hg hh ex\">Below are some tricks which a lot of frontend developers don&#8217;t know about. To do with HTML\/CSS\/JavaScript.<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<section class=\"ey ez fa fb fc\">\n<div class=\"n p\">\n<div class=\"ab ac ae af ag fd ai aj\">\n<p id=\"4946\" class=\"jl jm fg jn b ge jo jp jq gh jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg ey ce\" data-selectable-paragraph=\"\">Hopefully, there will be at least a couple on the list which you didn&#8217;t know about!<\/p>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"ey ez fa fb fc\">\n<div class=\"n p\">\n<div class=\"ab ac ae af ag fd ai aj\">\n<h2 id=\"bc3a\" class=\"ko kp fg au kq kr ks gg kt ku kv gj kw gk kx gm ky gn kz gp la gq lb gs lc ld ce\" data-selectable-paragraph=\"\">1. Datalist element<\/h2>\n<p id=\"91c9\" class=\"jl jm fg jn b ge le jp jq gh lf js jt ju lg jw jx jy lh ka kb kc li ke kf kg ey ce\" data-selectable-paragraph=\"\">One HTML element that you don\u2019t see used much at all and for no reason!<\/p>\n<p id=\"1fc7\" class=\"jl jm fg jn b ge jo jp jq gh jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg ey ce\" data-selectable-paragraph=\"\">The <code class=\"\" data-line=\"\">&lt;datalist&gt;<\/code> tag is used to provide an &#8220;autocomplete&#8221; feature for <code class=\"\" data-line=\"\">&lt;input&gt;<\/code>elements. You will see a drop-down list of pre-defined options as you type.<\/p>\n<figure class=\"im in io ip iq ir er es paragraph-image\">\n<div class=\"er es ln\">\n<div class=\"iz s cg ja\">\n<div class=\"lo jc s\">\n<div class=\"cc iv t u v iw aj bv ix iy\"><\/div>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"sl sm t u v iw aj c\" src=\"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2020\/10\/10U-rN1M_Vh0a2Cs_TAnGKw.png?resize=249%2C185&#038;ssl=1\" sizes=\"auto, 249px\" srcset=\"\" alt=\"Image for post\" width=\"249\" height=\"185\" \/><\/div>\n<\/div>\n<\/div><figcaption class=\"jg jh et er es ji jj au b av aw ax\" data-selectable-paragraph=\"\">&lt;datalist&gt;<\/figcaption><\/figure>\n<p id=\"8ef8\" class=\"jl jm fg jn b ge jo jp jq gh jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg ey ce\" data-selectable-paragraph=\"\"><em class=\"lp\">Example:<\/em><\/p>\n<pre class=\"im in io ip iq lq lr dy\"><span id=\"8bb8\" class=\"ce ko kp fg lm b cb ls lt s lu\" data-selectable-paragraph=\"\">&lt;input <strong class=\"lm lv\">list=\"animals\"<\/strong> name=\"animal\" id=\"animal\"&gt;<\/span><span id=\"5fdb\" class=\"ce ko kp fg lm b cb lw lx ly lz ma lt s lu\" data-selectable-paragraph=\"\">&lt;datalist <strong class=\"lm lv\">id=\"animals\"<\/strong>&gt;\n    &lt;option value=\"Cat\"&gt;\n    &lt;option value=\"Dog\"&gt;\n    &lt;option value=\"Chicken\"&gt;\n    &lt;option value=\"Cow\"&gt;\n    &lt;option value=\"Pig\"&gt;\n  &lt;\/datalist&gt;<\/span><\/pre>\n<p id=\"9155\" class=\"jl jm fg jn b ge jo jp jq gh jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg ey ce\" data-selectable-paragraph=\"\">The <code class=\"\" data-line=\"\">&lt;datalist&gt;<\/code> list attribute (see bold items above) must be equal to the id of the <code class=\"\" data-line=\"\">&lt;input&gt;<\/code> , this is what binds them together.<\/p>\n<\/div>\n<\/div>\n<\/section>\n<div class=\"n p gu kh ki kj\" role=\"separator\"><\/div>\n<section class=\"ey ez fa fb fc\">\n<div class=\"n p\">\n<div class=\"ab ac ae af ag fd ai aj\">\n<h2 id=\"3725\" class=\"ko kp fg au kq kr ks gg kt ku kv gj kw gk kx gm ky gn kz gp la gq lb gs lc ld ce\" data-selectable-paragraph=\"\">2. Clickable label with a checkbox<\/h2>\n<p id=\"07a2\" class=\"jl jm fg jn b ge le jp jq gh lf js jt ju lg jw jx jy lh ka kb kc li ke kf kg ey ce\" data-selectable-paragraph=\"\">If you want a clickable label for checkbox, you would usually use have a <code class=\"\" data-line=\"\">label<\/code> element with a \u201cfor\u201d attribute, like below.<\/p>\n<pre class=\"im in io ip iq lq lr dy\"><span id=\"67c0\" class=\"ce ko kp fg lm b cb ls lt s lu\" data-selectable-paragraph=\"\">&lt;input type=\"checkbox\" name=\"checkbox\" id=\"checkbox_id\" value=\"value\"&gt;\n&lt;label for=\"checkbox_id\"&gt;I agree&lt;\/label&gt;<\/span><\/pre>\n<p id=\"b9e9\" class=\"jl jm fg jn b ge jo jp jq gh jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg ey ce\" data-selectable-paragraph=\"\">You can actually just put the <code class=\"\" data-line=\"\">label<\/code> element around the checkbox to accomplish the same thing. So when you click \u201cI agree\u201d it will select the checkbox!<\/p>\n<p id=\"5a7c\" class=\"jl jm fg jn b ge jo jp jq gh jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg ey ce\" data-selectable-paragraph=\"\"><em class=\"lp\">Example:<\/em><\/p>\n<pre class=\"im in io ip iq lq lr dy\"><span id=\"ca7b\" class=\"ce ko kp fg lm b cb ls lt s lu\" data-selectable-paragraph=\"\">&lt;label&gt;&lt;input type=\"checkbox\" name=\"checkbox\" id=\"checkbox_id\" value=\"value\"&gt;I agree&lt;\/label&gt;<\/span><\/pre>\n<\/div>\n<\/div>\n<\/section>\n<div class=\"n p gu kh ki kj\" role=\"separator\"><\/div>\n<section class=\"ey ez fa fb fc\">\n<div class=\"n p\">\n<div class=\"ab ac ae af ag fd ai aj\">\n<h2 id=\"0edb\" class=\"ko kp fg au kq kr ks gg kt ku kv gj kw gk kx gm ky gn kz gp la gq lb gs lc ld ce\" data-selectable-paragraph=\"\">3. Child selectors<\/h2>\n<p id=\"d03e\" class=\"jl jm fg jn b ge le jp jq gh lf js jt ju lg jw jx jy lh ka kb kc li ke kf kg ey ce\" data-selectable-paragraph=\"\">Probably more of the most well used on this list but most people don\u2019t know the extent of their power.<\/p>\n<p id=\"dd65\" class=\"jl jm fg jn b ge jo jp jq gh jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg ey ce\" data-selectable-paragraph=\"\">Child Selectors are used to match all the elements which are a child of a specified element. It gives the relation between two elements.<\/p>\n<p id=\"00c3\" class=\"jl jm fg jn b ge jo jp jq gh jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg ey ce\" data-selectable-paragraph=\"\"><em class=\"lp\">Examples:<\/em><\/p>\n<pre class=\"im in io ip iq lq lr dy\"><span id=\"4e21\" class=\"ce ko kp fg lm b cb ls lt s lu\" data-selectable-paragraph=\"\"> \/* 1st &lt;li&gt; element *\/\n li:first-child { \n    color: red;\n }<\/span><span id=\"07ff\" class=\"ce ko kp fg lm b cb lw lx ly lz ma lt s lu\" data-selectable-paragraph=\"\">\/* Last &lt;li&gt; element *\/\n li:last-child { \n     color: green;\n }<\/span><span id=\"e04d\" class=\"ce ko kp fg lm b cb lw lx ly lz ma lt s lu\" data-selectable-paragraph=\"\">\/\/ Select All &lt;li&gt; elements but The First Three *\/\nli:nth-child(n+4) {     \n      color: yellow;    \n}<\/span><span id=\"6136\" class=\"ce ko kp fg lm b cb lw lx ly lz ma lt s lu\" data-selectable-paragraph=\"\">\/* Select only the first 3 &lt;li&gt; elemets *\/\nli:nth-child(-n+3) {     \n    color: green;    \n}<\/span><span id=\"d4b8\" class=\"ce ko kp fg lm b cb lw lx ly lz ma lt s lu\" data-selectable-paragraph=\"\">\/* Styles are elements that are not a &lt;p&gt; *\/\n.my-class:not(p) { \n    display: none;\n}<\/span><\/pre>\n<\/div>\n<\/div>\n<\/section>\n<div class=\"n p gu kh ki kj\" role=\"separator\"><\/div>\n<section class=\"ey ez fa fb fc\">\n<div class=\"n p\">\n<div class=\"ab ac ae af ag fd ai aj\">\n<h2 id=\"1819\" class=\"ko kp fg au kq kr ks gg kt ku kv gj kw gk kx gm ky gn kz gp la gq lb gs lc ld ce\" data-selectable-paragraph=\"\">4. Writing mode<\/h2>\n<p id=\"dd23\" class=\"jl jm fg jn b ge le jp jq gh lf js jt ju lg jw jx jy lh ka kb kc li ke kf kg ey ce\" data-selectable-paragraph=\"\">Writing mode is little known yet quite powerful CSS property.<\/p>\n<p id=\"3402\" class=\"jl jm fg jn b ge jo jp jq gh jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg ey ce\" data-selectable-paragraph=\"\">This allows text to run vertically like this:<\/p>\n<figure class=\"im in io ip iq ir er es paragraph-image\">\n<div class=\"er es ln\">\n<div class=\"iz s cg ja\">\n<div class=\"mb jc s\">\n<div class=\"cc iv t u v iw aj bv ix iy\"><\/div>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"sl sm t u v iw aj c\" src=\"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2020\/10\/1xItikwe9cbOUDYNG-6MW6A.png?resize=249%2C295&#038;ssl=1\" sizes=\"auto, 249px\" srcset=\"\" alt=\"Image for post\" width=\"249\" height=\"295\" \/><\/div>\n<\/div>\n<\/div><figcaption class=\"jg jh et er es ji jj au b av aw ax\" data-selectable-paragraph=\"\">Vertical text<\/figcaption><\/figure>\n<p id=\"0f6f\" class=\"jl jm fg jn b ge jo jp jq gh jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg ey ce\" data-selectable-paragraph=\"\">The code for accomplishing this very simple.<\/p>\n<pre class=\"im in io ip iq lq lr dy\"><span id=\"be60\" class=\"ce ko kp fg lm b cb ls lt s lu\" data-selectable-paragraph=\"\">writing-mode: vertical-rl;<\/span><\/pre>\n<p id=\"6803\" class=\"jl jm fg jn b ge jo jp jq gh jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg ey ce\" data-selectable-paragraph=\"\"><em class=\"lp\">Full example:<\/em><\/p>\n<pre class=\"im in io ip iq lq lr dy\"><span id=\"5b96\" class=\"ce ko kp fg lm b cb ls lt s lu\" data-selectable-paragraph=\"\">&lt;style&gt;\n.sideway { \n   writing-mode: vertical-rl;\n}\n.normal {\n   width: 5%;\n   float: left;\n}\n&lt;\/style&gt;\n&lt;p class=\"normal\"&gt;\n     Hi some paragraph text\n&lt;\/p&gt;\n&lt;p class=\"sideway\"&gt; \n     Hey I'm some sidway text \n&lt;\/p&gt;<\/span><\/pre>\n<p id=\"46a6\" class=\"jl jm fg jn b ge jo jp jq gh jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg ey ce\" data-selectable-paragraph=\"\">The <code class=\"\" data-line=\"\">writing-mode<\/code> property has five possible options.<\/p>\n<pre class=\"im in io ip iq lq lr dy\"><span id=\"f767\" class=\"ce ko kp fg lm b cb ls lt s lu\" data-selectable-paragraph=\"\">  writing-mode: horizontal-tb;\n  writing-mode: vertical-rl;\n  writing-mode: vertical-lr;\n  writing-mode: sideways-rl;\n  writing-mode: sideways-lr;<\/span><\/pre>\n<\/div>\n<\/div>\n<\/section>\n<div class=\"n p gu kh ki kj\" role=\"separator\"><\/div>\n<section class=\"ey ez fa fb fc\">\n<div class=\"n p\">\n<div class=\"ab ac ae af ag fd ai aj\">\n<h2 id=\"6495\" class=\"ko kp fg au kq kr ks gg kt ku kv gj kw gk kx gm ky gn kz gp la gq lb gs lc ld ce\" data-selectable-paragraph=\"\">5. calc() function<\/h2>\n<p id=\"e133\" class=\"jl jm fg jn b ge le jp jq gh lf js jt ju lg jw jx jy lh ka kb kc li ke kf kg ey ce\" data-selectable-paragraph=\"\">The <code class=\"\" data-line=\"\">calc()<\/code> CSS function lets you perform calculations when specifying CSS property values.<\/p>\n<p id=\"1108\" class=\"jl jm fg jn b ge jo jp jq gh jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg ey ce\" data-selectable-paragraph=\"\">The most useful ability of <code class=\"\" data-line=\"\">calc()<\/code> is its ability to mix units, like percentages and pixels. No Preprocessor will ever be able to do that. It is something that has to happen at render time.<\/p>\n<p id=\"a1b8\" class=\"jl jm fg jn b ge jo jp jq gh jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg ey ce\" data-selectable-paragraph=\"\"><em class=\"lp\">Examples:<\/em><\/p>\n<pre class=\"im in io ip iq lq lr dy\"><span id=\"94c8\" class=\"ce ko kp fg lm b cb ls lt s lu\" data-selectable-paragraph=\"\">width: calc(5px + 100px);\nwidth: calc(6em * 8);\nwidth: calc(100% - 50px);<\/span><\/pre>\n<\/div>\n<\/div>\n<\/section>\n<div class=\"n p gu kh ki kj\" role=\"separator\"><\/div>\n<section class=\"ey ez fa fb fc\">\n<div class=\"n p\">\n<div class=\"ab ac ae af ag fd ai aj\">\n<h2 id=\"fa5c\" class=\"ko kp fg au kq kr ks gg kt ku kv gj kw gk kx gm ky gn kz gp la gq lb gs lc ld ce\" data-selectable-paragraph=\"\">6. Math.round &amp; Math.floor alternatives<\/h2>\n<p id=\"b232\" class=\"jl jm fg jn b ge le jp jq gh lf js jt ju lg jw jx jy lh ka kb kc li ke kf kg ey ce\" data-selectable-paragraph=\"\">Maybe not the easiest to read but still a cool trick.<\/p>\n<p id=\"f916\" class=\"jl jm fg jn b ge jo jp jq gh jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg ey ce\" data-selectable-paragraph=\"\"><code class=\"\" data-line=\"\">Math.floor()<\/code> you can use <code class=\"\" data-line=\"\">0|<\/code>:<\/p>\n<pre class=\"im in io ip iq lq lr dy\"><span id=\"aacd\" class=\"ce ko kp fg lm b cb ls lt s lu\" data-selectable-paragraph=\"\"><strong class=\"lm lv\">0|<\/strong>743.4343 \/\/ returns 743\nMath.floor(743.4343) \/\/ returns 743<\/span><\/pre>\n<p id=\"efb9\" class=\"jl jm fg jn b ge jo jp jq gh jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg ey ce\" data-selectable-paragraph=\"\"><code class=\"\" data-line=\"\">Math.round()<\/code> you can use <code class=\"\" data-line=\"\">+.5|0<\/code> :<\/p>\n<pre class=\"im in io ip iq lq lr dy\"><span id=\"0515\" class=\"ce ko kp fg lm b cb ls lt s lu\" data-selectable-paragraph=\"\">812.777<strong class=\"lm lv\">+.5|0<\/strong> \/\/ returns 813\nMath.round(812.777) \/\/ returns 813<\/span><\/pre>\n<\/div>\n<\/div>\n<\/section>\n<div class=\"n p gu kh ki kj\" role=\"separator\"><\/div>\n<section class=\"ey ez fa fb fc\">\n<div class=\"n p\">\n<div class=\"ab ac ae af ag fd ai aj\">\n<h2 id=\"f1f9\" class=\"ko kp fg au kq kr ks gg kt ku kv gj kw gk kx gm ky gn kz gp la gq lb gs lc ld ce\" data-selectable-paragraph=\"\">7. Console.table<\/h2>\n<p id=\"8e81\" class=\"jl jm fg jn b ge le jp jq gh lf js jt ju lg jw jx jy lh ka kb kc li ke kf kg ey ce\" data-selectable-paragraph=\"\">Hopefully, by now you have heard and used <code class=\"\" data-line=\"\">console.log()<\/code> but one you may not is <code class=\"\" data-line=\"\">console.table()<\/code> which takes in an array or an object. This displays a table in the console view in a very neat way!<\/p>\n<p id=\"77a2\" class=\"jl jm fg jn b ge jo jp jq gh jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg ey ce\" data-selectable-paragraph=\"\"><em class=\"lp\">Array Example:<\/em><\/p>\n<pre class=\"im in io ip iq lq lr dy\"><span id=\"e5d1\" class=\"ce ko kp fg lm b cb ls lt s lu\" data-selectable-paragraph=\"\">let car1 = { name : \"Audi\", model : \"A4\" }\nlet car2 = { name : \"Volvo\", model : \"XC90\" }\nlet car3 = { name : \"Ford\", model : \"Fusion\" }<\/span><span id=\"2299\" class=\"ce ko kp fg lm b cb lw lx ly lz ma lt s lu\" data-selectable-paragraph=\"\">console.table([car1, car2, car3]);<\/span><\/pre>\n<figure class=\"im in io ip iq ir er es paragraph-image\">\n<div class=\"is it cg iu aj\">\n<div class=\"er es mc\">\n<div class=\"iz s cg ja\">\n<div class=\"md jc s\">\n<div class=\"cc iv t u v iw aj bv ix iy\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"t u v iw aj jd je aq wb\" src=\"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2020\/10\/17UCwjFU2l66AdrXqqdWPgw.png?resize=910%2C194&#038;ssl=1\" alt=\"Image for post\" width=\"910\" height=\"194\" \/><\/div>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"sl sm t u v iw aj c\" src=\"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2020\/10\/17UCwjFU2l66AdrXqqdWPgw-1.png?resize=910%2C194&#038;ssl=1\" sizes=\"auto, 700px\" srcset=\"https:\/\/miro.medium.com\/max\/331\/1*7UCwjFU2l66AdrXqqdWPgw.png 276w, https:\/\/miro.medium.com\/max\/662\/1*7UCwjFU2l66AdrXqqdWPgw.png 552w, https:\/\/miro.medium.com\/max\/768\/1*7UCwjFU2l66AdrXqqdWPgw.png 640w, https:\/\/miro.medium.com\/max\/840\/1*7UCwjFU2l66AdrXqqdWPgw.png 700w\" alt=\"Image for post\" width=\"910\" height=\"194\" \/><\/div>\n<\/div>\n<\/div>\n<\/div><figcaption class=\"jg jh et er es ji jj au b av aw ax\" data-selectable-paragraph=\"\">console.table()<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<\/section>\n<div class=\"n p gu kh ki kj\" role=\"separator\"><\/div>\n<section class=\"ey ez fa fb fc\">\n<div class=\"n p\">\n<div class=\"ab ac ae af ag fd ai aj\">\n<h2 id=\"61ff\" class=\"ko kp fg au kq kr ks gg kt ku kv gj kw gk kx gm ky gn kz gp la gq lb gs lc ld ce\" data-selectable-paragraph=\"\">8. Console.time<\/h2>\n<p id=\"3868\" class=\"jl jm fg jn b ge le jp jq gh lf js jt ju lg jw jx jy lh ka kb kc li ke kf kg ey ce\" data-selectable-paragraph=\"\">Another useful console method. <code class=\"\" data-line=\"\">console.time()<\/code> starts a timer. It takes a parameter as a label. Then you use <code class=\"\" data-line=\"\">console.timeEnd()<\/code> with the same label name and the console will output the time in milliseconds from when you called <code class=\"\" data-line=\"\">console.time()<\/code> and <code class=\"\" data-line=\"\">console.timeEnd()<\/code><\/p>\n<figure class=\"im in io ip iq ir er es paragraph-image\">\n<div class=\"is it cg iu aj\">\n<div class=\"er es me\">\n<div class=\"iz s cg ja\">\n<div class=\"mf jc s\">\n<div class=\"cc iv t u v iw aj bv ix iy\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"t u v iw aj jd je aq wb\" src=\"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2020\/10\/1H2fApbXE6q4mKBfWaUDILQ.png?resize=910%2C88&#038;ssl=1\" alt=\"Image for post\" width=\"910\" height=\"88\" \/><\/div>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"sl sm t u v iw aj c\" src=\"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2020\/10\/1H2fApbXE6q4mKBfWaUDILQ-1.png?resize=910%2C88&#038;ssl=1\" sizes=\"auto, 700px\" srcset=\"https:\/\/miro.medium.com\/max\/331\/1*H2fApbXE6q4mKBfWaUDILQ.png 276w, https:\/\/miro.medium.com\/max\/662\/1*H2fApbXE6q4mKBfWaUDILQ.png 552w, https:\/\/miro.medium.com\/max\/768\/1*H2fApbXE6q4mKBfWaUDILQ.png 640w, https:\/\/miro.medium.com\/max\/840\/1*H2fApbXE6q4mKBfWaUDILQ.png 700w\" alt=\"Image for post\" width=\"910\" height=\"88\" \/><\/div>\n<\/div>\n<\/div>\n<\/div><figcaption class=\"jg jh et er es ji jj au b av aw ax\" data-selectable-paragraph=\"\">console.time()<\/figcaption><\/figure>\n<p id=\"af5c\" class=\"jl jm fg jn b ge jo jp jq gh jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg ey ce\" data-selectable-paragraph=\"\"><em class=\"lp\">Example:<\/em><\/p>\n<pre class=\"im in io ip iq lq lr dy\"><span id=\"3dbd\" class=\"ce ko kp fg lm b cb ls lt s lu\" data-selectable-paragraph=\"\">\/\/ Starts the timer\nconsole.time(\"MyTimer\");<\/span><span id=\"b958\" class=\"ce ko kp fg lm b cb lw lx ly lz ma lt s lu\" data-selectable-paragraph=\"\">\/\/ Ends the timer and outputs the time in milliseconds\nconsole.timeEnd(\"MyTimer\");<\/span><\/pre>\n<\/div>\n<\/div>\n<\/section>\n<div class=\"n p gu kh ki kj\" role=\"separator\"><\/div>\n<section class=\"ey ez fa fb fc\">\n<div class=\"n p\">\n<div class=\"ab ac ae af ag fd ai aj\">\n<h2 id=\"4dfd\" class=\"ko kp fg au kq kr ks gg kt ku kv gj kw gk kx gm ky gn kz gp la gq lb gs lc ld ce\" data-selectable-paragraph=\"\">9. In operator<\/h2>\n<p id=\"1d98\" class=\"jl jm fg jn b ge le jp jq gh lf js jt ju lg jw jx jy lh ka kb kc li ke kf kg ey ce\" data-selectable-paragraph=\"\">The \u201cin\u201d operator can check if an index exists in an array and will return true or false.<\/p>\n<p id=\"59bd\" class=\"jl jm fg jn b ge jo jp jq gh jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg ey ce\" data-selectable-paragraph=\"\"><em class=\"lp\">Example:<\/em><\/p>\n<pre class=\"im in io ip iq lq lr dy\"><span id=\"caec\" class=\"ce ko kp fg lm b cb ls lt s lu\" data-selectable-paragraph=\"\">let cars = ['Audi', 'BMW', 'Mini', 'Bentley', 'Porsche'];<\/span><span id=\"89d3\" class=\"ce ko kp fg lm b cb lw lx ly lz ma lt s lu\" data-selectable-paragraph=\"\">0 in cars        \/\/ returns true\n3 in cars        \/\/ returns true\n6 in cars        \/\/ returns false<\/span><\/pre>\n<p id=\"9b1e\" class=\"jl jm fg jn b ge jo jp jq gh jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg ey ce\" data-selectable-paragraph=\"\">You can also check if a property exists in an object.<\/p>\n<p id=\"fe35\" class=\"jl jm fg jn b ge jo jp jq gh jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg ey ce\" data-selectable-paragraph=\"\"><em class=\"lp\">Example:<\/em><\/p>\n<pre class=\"im in io ip iq lq lr dy\"><span id=\"5c2b\" class=\"ce ko kp fg lm b cb ls lt s lu\" data-selectable-paragraph=\"\">const person = { firstName : \"Dave\", surname: \"Smith\", age: 34 };<\/span><span id=\"3130\" class=\"ce ko kp fg lm b cb lw lx ly lz ma lt s lu\" data-selectable-paragraph=\"\">'firstName' in person  \/\/ returns true\n'surname' in person    \/\/ returns true\n'age' in person        \/\/ returns true\n'gendar' in person     \/\/ returns false<\/span><\/pre>\n<\/div>\n<\/div>\n<\/section>\n<div class=\"n p gu kh ki kj\" role=\"separator\"><\/div>\n<section class=\"ey ez fa fb fc\">\n<div class=\"n p\">\n<div class=\"ab ac ae af ag fd ai aj\">\n<h2 id=\"5679\" class=\"ko kp fg au kq kr ks gg kt ku kv gj kw gk kx gm ky gn kz gp la gq lb gs lc ld ce\" data-selectable-paragraph=\"\">10. Ma<strong class=\"be\">ke Chrome a text editor<\/strong><\/h2>\n<p id=\"e890\" class=\"jl jm fg jn b ge le jp jq gh lf js jt ju lg jw jx jy lh ka kb kc li ke kf kg ey ce\" data-selectable-paragraph=\"\">Maybe a very random one on the list. If you enter the below in URL bar and hit the return key. It will turn Chrome into a notepad<\/p>\n<pre class=\"im in io ip iq lq lr dy\"><span id=\"a735\" class=\"ce ko kp fg lm b cb ls lt s lu\" data-selectable-paragraph=\"\">data:text\/html, &lt;html contenteditable&gt;<\/span><\/pre>\n<\/div>\n<\/div>\n<\/section>\n<div class=\"n p gu kh ki kj\" role=\"separator\"><\/div>\n<section class=\"ey ez fa fb fc\">\n<div class=\"n p\">\n<div class=\"ab ac ae af ag fd ai aj\">\n<h2 id=\"e2b2\" class=\"ko kp fg au kq kr ks gg kt ku kv gj kw gk kx gm ky gn kz gp la gq lb gs lc ld ce\" data-selectable-paragraph=\"\">11. Multiple statements in if block without curly brackets<\/h2>\n<p id=\"99e0\" class=\"jl jm fg jn b ge le jp jq gh lf js jt ju lg jw jx jy lh ka kb kc li ke kf kg ey ce\" data-selectable-paragraph=\"\">I wouldn\u2019t use this actual production code but still one a lot of people don\u2019t know about. The trick is the comma!<\/p>\n<pre class=\"im in io ip iq lq lr dy\"><span id=\"6b78\" class=\"ce ko kp fg lm b cb ls lt s lu\" data-selectable-paragraph=\"\">if (1 === 1)\n alert(\"Alert 1\"), alert(\"Alert 2\");<\/span><\/pre>\n<\/div>\n<\/div>\n<\/section>\n<div class=\"n p gu kh ki kj\" role=\"separator\"><\/div>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\">Interesting tricks you can do with HTML\/JS\/CSS Source: 11 Frontend tricks that most Frontend Developers don\u2019t know about | by Daniel Anderson | JavaScript In Plain English | Oct, 2020 | Medium<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"https:\/\/monodes.com\/predaelli\/2020\/10\/17\/11-frontend-tricks-that-most-frontend-developers-dont-know-about-by-daniel-anderson-javascript-in-plain-english-oct-2020-medium\/\">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":[50],"tags":[],"class_list":["post-7689","post","type-post","status-publish","format-standard","hentry","category-javascript"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6daft-201","jetpack-related-posts":[{"id":9590,"url":"https:\/\/monodes.com\/predaelli\/2022\/09\/12\/mastering-these-7-basics-css-skills-will-make-you-a-frontend-wizard-%f0%9f%a7%99%e2%9c%a8\/","url_meta":{"origin":7689,"position":0},"title":"Mastering these 7 Basics CSS Skills will make you a Frontend Wizard \ud83e\uddd9\u2728","author":"Paolo Redaelli","date":"2022-09-12","format":false,"excerpt":"Sometimes I wish they won't use proprietary platoforms such as Medium. Neverthelesse its daily mail is interesting, like today's Mastering these 7 Basics CSS Skills will make you a Frontend Wizard \ud83e\uddd9\u2728 \u00a0","rel":"","context":"In &quot;Themes&quot;","block_context":{"text":"Themes","link":"https:\/\/monodes.com\/predaelli\/category\/themes\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":9664,"url":"https:\/\/monodes.com\/predaelli\/2022\/09\/27\/15-weird-googling-tricks-99-9-of-developers-dont-know-about-javascript-in-plain-english\/","url_meta":{"origin":7689,"position":1},"title":"15 Weird Googling Tricks 99.9% of Developers Don&#8217;t Know\u00a0About | JavaScript in Plain English","author":"Paolo Redaelli","date":"2022-09-27","format":false,"excerpt":"15 Weird Googling Tricks 99.9% of Developers Don't Know\u00a0About | JavaScript in Plain English Well, I know most of them.","rel":"","context":"In &quot;Tricks&quot;","block_context":{"text":"Tricks","link":"https:\/\/monodes.com\/predaelli\/category\/documentations\/tricks\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":893,"url":"https:\/\/monodes.com\/predaelli\/2016\/01\/15\/wordpress-front-end-editor-plugins\/","url_meta":{"origin":7689,"position":2},"title":"WordPress Front End Editor Plugins","author":"Paolo Redaelli","date":"2016-01-15","format":false,"excerpt":"5 Best WordPress Front End Editor Plugins to consider - 85ideas.com WordPress Front End Editor is changing how we manage the front-end posts\/pages. Check out new developments in front-end editors(both free and paid). WP Front End Editor WP Quick FrontEnd Editor","rel":"","context":"In &quot;Wordpress&quot;","block_context":{"text":"Wordpress","link":"https:\/\/monodes.com\/predaelli\/category\/wordpress\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5369,"url":"https:\/\/monodes.com\/predaelli\/2019\/03\/19\/8-useful-css-tricks-parallax-images-sticky-footers-and-more\/","url_meta":{"origin":7689,"position":3},"title":"8 useful CSS tricks: Parallax images, sticky footers and more","author":"Paolo Redaelli","date":"2019-03-19","format":"link","excerpt":"8 useful CSS tricks: Parallax images, sticky footers and more This article shares some of my most satisfying \u201cah-hah!\u201d moments learning CSS, and I hope it can prompt some \u201cah-hah!\u201d moments for you too. Sticky Footer Zoom-on-Hover Images Instant Night Mode Custom Bullet Points Parallax Images Animation with Cropped Images\u2026","rel":"","context":"In &quot;HTML&quot;","block_context":{"text":"HTML","link":"https:\/\/monodes.com\/predaelli\/category\/html\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8400,"url":"https:\/\/monodes.com\/predaelli\/2021\/05\/04\/5-awesome-css-tricks\/","url_meta":{"origin":7689,"position":4},"title":"5 Awesome CSS tricks","author":"Paolo Redaelli","date":"2021-05-04","format":false,"excerpt":"Do awesome things in fewer code lines with CSS Source: 5 Awesome CSS tricks every developer should know | by FAM | Apr, 2021 | Level Up Coding Smooth scrolling: html { scroll-behavior: smooth; } Resize images to fit img { max-width:100%; height:auto; } #3: Setting an image as cursor\u2026","rel":"","context":"In &quot;HTML&quot;","block_context":{"text":"HTML","link":"https:\/\/monodes.com\/predaelli\/category\/html\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8592,"url":"https:\/\/monodes.com\/predaelli\/2021\/08\/04\/why-you-should-stop-using-ui-frameworks-by-beau-beauchamp-nerd-for-tech-medium\/","url_meta":{"origin":7689,"position":5},"title":"Why You Should Stop Using UI Frameworks | by Beau Beauchamp | Nerd For Tech | Medium","author":"Paolo Redaelli","date":"2021-08-04","format":"link","excerpt":"I\u2019ve been a web application developer for over 20 years. I\u2019ve seen all kinds of UI libraries come and I\u2019ve seen them go. I\u2019ve been in the\u2026 Source: Why You Should Stop Using UI Frameworks | by Beau Beauchamp | Nerd For Tech | Medium I once interviewed with a\u2026","rel":"","context":"In &quot;Javascript&quot;","block_context":{"text":"Javascript","link":"https:\/\/monodes.com\/predaelli\/category\/javascript\/"},"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\/7689","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=7689"}],"version-history":[{"count":0,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/7689\/revisions"}],"wp:attachment":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/media?parent=7689"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/categories?post=7689"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/tags?post=7689"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}