<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Emmanuel Chikwendu Onah</title>
    <description>The latest articles on Forem by Emmanuel Chikwendu Onah (@emmanuelonah).</description>
    <link>https://forem.com/emmanuelonah</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F291110%2Fd9462130-976f-449a-9574-9c26e29f4173.jpeg</url>
      <title>Forem: Emmanuel Chikwendu Onah</title>
      <link>https://forem.com/emmanuelonah</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/emmanuelonah"/>
    <language>en</language>
    <item>
      <title>Demystification of JavaScript Code processing using V8 as the targeted engine 🔬</title>
      <dc:creator>Emmanuel Chikwendu Onah</dc:creator>
      <pubDate>Wed, 01 Feb 2023 20:25:36 +0000</pubDate>
      <link>https://forem.com/emmanuelonah/demystification-of-javascript-code-processing-using-v8-as-the-targeted-engine-1k4a</link>
      <guid>https://forem.com/emmanuelonah/demystification-of-javascript-code-processing-using-v8-as-the-targeted-engine-1k4a</guid>
      <description>&lt;p&gt;So, we will be looking at how your JavaScript code gets processed. From you &lt;strong&gt;writing your Js code&lt;/strong&gt; to the &lt;strong&gt;computer understanding it&lt;/strong&gt; and &lt;strong&gt;doing what you asked&lt;/strong&gt; 💻.  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It's all about bringing you closer to the system 🔎.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Phase 1: Coding Js
&lt;/h2&gt;

&lt;p&gt;You write your Js code e.g:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;checkIsAValidObject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;object&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Phase 2: Host env setup
&lt;/h2&gt;

&lt;p&gt;You take your code to a JavaScript host-env e.g Browser/Node. The host will do what we call the "initial time branch", during the initial time branching it gets the required components required to run your JavaScript code e.g core V8 engine, APIs(e.g DOM API, libuv API).&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 3: Compilation
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Your JavaScript code gets compiled to &lt;strong&gt;AST(Abstraction Syntax Tree)&lt;/strong&gt;. Its a format that Our ISA(Instruction Set Architecture) machine/engine can process, the idea is similar to when you want to use &lt;strong&gt;Theo-design-token-engine&lt;/strong&gt; to compile from one &lt;strong&gt;style-model&lt;/strong&gt; to another e.g from &lt;strong&gt;CSS&lt;/strong&gt; to &lt;strong&gt;XML styles&lt;/strong&gt;, it means you must write in a model that &lt;strong&gt;theo&lt;/strong&gt; understand. Here is a link if you wish to see the AST in action:&lt;a href="https://astexplorer.net/" rel="noopener noreferrer"&gt;Click me&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Sample of Js code to AST
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm8xpuhyxpeqh8eeclhay.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm8xpuhyxpeqh8eeclhay.jpg" alt=" " width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After your code is converted to AST, the next thing is the hoisting of expressions and statements.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Phase 4: Generation of Executable Bytecode from the AST code
&lt;/h2&gt;

&lt;p&gt;At this stage, the JavaScript engine takes the &lt;strong&gt;AST code&lt;/strong&gt; and generates a &lt;strong&gt;bytecode&lt;/strong&gt; following an Instruction Set Architecture. For the v8 engine, we make use of &lt;strong&gt;ARMV8&lt;/strong&gt; which is a framework(i call it a framework because it's focused on specific machines and specific instruction architecture type) that implements a &lt;strong&gt;reduced instruction set&lt;/strong&gt;. These executable bytes are instructions(see it as a language) that the CPU understands and decodes. &lt;strong&gt;Note&lt;/strong&gt;, the CPU &lt;strong&gt;CAN NOT&lt;/strong&gt; execute this instruction (they are usually in hexadecimal format 0-f), what the CPU does is pull the our instruction from the memory and decode it to 0-1(which is the language the CPU understand). So, have it at the back of your mind that the CPU can not understand either reduced or complicated instructions until the CPU has decoded/translated it into a machine-code of 0-1.&lt;/p&gt;

&lt;h3&gt;
  
  
  To generate an executable bytecode for a Js code
&lt;/h3&gt;

&lt;p&gt;I will be sampling with macOS:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;brew install v8&lt;/code&gt;&lt;br&gt;
&lt;code&gt;run: d8 --print-bytecode your-js-file-absolute-path.js&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Sample of how to generate an executable bytecode for a Js code
&lt;/h3&gt;

&lt;h6&gt;
  
  
  The Js code
&lt;/h6&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgy7tygc07hwlbtomavhs.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgy7tygc07hwlbtomavhs.jpg" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  Install v8
&lt;/h6&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe4xaio4u1gu8lx2uw390.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe4xaio4u1gu8lx2uw390.jpg" alt=" " width="800" height="538"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  Generate the bytecode
&lt;/h6&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzjh20b6siercoov6mv71.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzjh20b6siercoov6mv71.jpg" alt=" " width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 5: Interpretation and Execution
&lt;/h2&gt;

&lt;p&gt;This is the stage we all have been waiting for. This is what distinguishes a compiled language and an interpretable language. When you hear an interpretable language, it doesn't mean your program doesn't get compiled to instruction, but rather it means you write your program, send it to your language runtime and the language engine does the compilation for you at the point of execution. On the other hand, a compiled language needs to be compiled to an instruction and then sent to a machine that needs it(e.g sending a Java Jar executable to run on android Os).&lt;/p&gt;

&lt;p&gt;At this stage, The JavaScript engine executes the executable file by running each instruction line by line e.g it sends an instruction that says &lt;strong&gt;&lt;em&gt;create a primitive variable called name and assign it a value "Emmanuel"&lt;/em&gt;&lt;/strong&gt;. The computer will execute the instruction which in simple terms means telling the computer to do what you want(i can write a detailed article on how the modern computers are architected to process instructions. Feel free to comment in the section below if the article would be useful to you).&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 6: Hot Optimization stage
&lt;/h2&gt;

&lt;p&gt;This stage is more of optimization, caching of frequently used bytecode. The Js engine will store the result of frequently interpreted &lt;code&gt;bytecode&lt;/code&gt; so the computer doesn't need to reprocess it.&lt;/p&gt;

&lt;h1&gt;
  
  
  Summary
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;You write Js code&lt;/li&gt;
&lt;li&gt;The JavaScript engine turns your Js code to bytecode Instructions(0-f)&lt;/li&gt;
&lt;li&gt;The Computer CPU(Usually the Control Unit) turns the bytecode instructions to machine code(0-1)&lt;/li&gt;
&lt;li&gt;Then the computer executes the machine code&lt;/li&gt;
&lt;li&gt;Then you get the result of the execution&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Functional React.Js Execution flow</title>
      <dc:creator>Emmanuel Chikwendu Onah</dc:creator>
      <pubDate>Wed, 01 Feb 2023 19:30:12 +0000</pubDate>
      <link>https://forem.com/emmanuelonah/functional-reactjs-execution-flow-419j</link>
      <guid>https://forem.com/emmanuelonah/functional-reactjs-execution-flow-419j</guid>
      <description>&lt;h2&gt;
  
  
  Table of Content
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;What is ReactJs&lt;/li&gt;
&lt;li&gt;ReactJs Life Cycle&lt;/li&gt;
&lt;li&gt;ReactJs Flow&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. What is ReactJs
&lt;/h2&gt;

&lt;p&gt;ReactJs is a JavaScript declarative UI library that makes it easier to create performant front-end applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. ReactJs Life Cycle
&lt;/h2&gt;

&lt;p&gt;ReactJs life cycle consists of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Mounting:&lt;/strong&gt; this is the first time a component gets painted into the virtual DOM and then the actual DOM.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Updating:&lt;/strong&gt; this is when a component gets updated into the virtual DOM(using the &lt;strong&gt;diffing&lt;/strong&gt; algorithm) and then gets injected into the actual DOM(using the reconciliation algorithm). This is what causes &lt;strong&gt;RERENDER&lt;/strong&gt; but doesn't cause REMOUNT.  usually caused by a component state update, component props update or a component parent update(that is when a wrapper component updates, the &lt;strong&gt;wrappedChildComponent&lt;/strong&gt; gets re-rendered also).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Unmounting:&lt;/strong&gt; this is the phase when a component gets removed from the virtual DOM and then gets removed from the actual DOM too. e.g when we navigate to another path, the previous path component gets unmounted.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Keywords to take note of:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Mounting:&lt;/strong&gt; I mean the first time a component gets constructed into the virtual DOM.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Update:&lt;/strong&gt; I mean when a component gets updated in the Virtual DOM.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unmounting:&lt;/strong&gt; when a component gets removed from the Virtual DOM.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. ReactJs Flow:
&lt;/h2&gt;

&lt;p&gt;I will break this into 8 phases for better understanding:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Virtual DOM construction:&lt;/strong&gt; this is the phase where ReactJs program constructs the virtual DOM for the FIRST TIME.&lt;/p&gt;

&lt;h3&gt;
  
  
  How is the virtual DOM constructed
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;It takes the returned element from a component(i mean the ReactElement) and then maps each element object hierarchically with a unique key attached to them.&lt;/li&gt;
&lt;li&gt;If any Element object uses the component &lt;code&gt;prop&lt;/code&gt; or &lt;code&gt;state&lt;/code&gt;, the initial value of them will be present in the virtual DOM.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. After Virtual DOM construction:&lt;/strong&gt; this is the phase when the virtual DOM has just been constructed for the first time. And this is the phase when your &lt;code&gt;useLayoutEffect&lt;/code&gt; runs&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Actual DOM construction:&lt;/strong&gt; this is the phase when React takes the content of the virtual DOM and injects it into the actual DOM.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. After Actual DOM construction:&lt;/strong&gt; this is the phase when the actual &lt;code&gt;DOM&lt;/code&gt; construction has just finished. At this phase is when the &lt;code&gt;useEffect&lt;/code&gt; gets to run. And that is why when you have a code let's say a &lt;code&gt;setState&lt;/code&gt; in &lt;code&gt;useLayoutEffect&lt;/code&gt; and useEffect, that of useEffect update will replace the update of useLayoutEffect after a successful run.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Virtual DOM update:&lt;/strong&gt; this is the phase when the virtual DOM needs to be updated because a component and its returned element object have been updated.&lt;br&gt;
&lt;strong&gt;Note:&lt;/strong&gt; an update to virtual DOM is an update to actual DOM. If nothing new changes in your component, virtual DOM will not update thanks to ReactJs &lt;strong&gt;diffing algorithm&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  what causes the virtual DOM to update?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;When a component state which is used "by a returned element" gets updated&lt;/li&gt;
&lt;li&gt;When component props which are used "by a returned element" get updated&lt;/li&gt;
&lt;li&gt;A parent component gets updated and the child component is not &lt;code&gt;memoized(React.memo)&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  How virtual dom is updated?
&lt;/h3&gt;

&lt;p&gt;ReactJs program doesn't just take the returned element object of a component to update the old virtual DOM content. But rather, it tries to check if the incoming object has different content from the current one and it only changes the new part e.g it picks the prop that has changed. And this whole process is termed the "diffing process".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. After Virtual DOM update:&lt;/strong&gt; &lt;code&gt;useLayoutEffect&lt;/code&gt; runs&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Actual DOM update:&lt;/strong&gt; at this phase, ReactJs doesn't just take the virtual DOM content and inject it into the actual DOM. But rather, it uses what we call the "reconciliation algorithm" to determine the node that needs to be updated in the actual DOM and then it updates only the changed part.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. After the Actual DOM update:&lt;/strong&gt;  this is the phase when the &lt;code&gt;useEffect&lt;/code&gt; gets run.&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>career</category>
      <category>mobile</category>
      <category>howto</category>
    </item>
    <item>
      <title>Power of the "new" keyword during constructor instantiation in JavaScript</title>
      <dc:creator>Emmanuel Chikwendu Onah</dc:creator>
      <pubDate>Sat, 04 Jun 2022 04:38:49 +0000</pubDate>
      <link>https://forem.com/emmanuelonah/power-of-the-new-keyword-during-constructor-instantiation-in-javascript-482c</link>
      <guid>https://forem.com/emmanuelonah/power-of-the-new-keyword-during-constructor-instantiation-in-javascript-482c</guid>
      <description>&lt;p&gt;&lt;strong&gt;What we will discuss&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What is the &lt;em&gt;new&lt;/em&gt; keyword in constructor instantiation&lt;/li&gt;
&lt;li&gt;What happens if we don't use the &lt;em&gt;new&lt;/em&gt; keyword during constructor instantiation&lt;/li&gt;
&lt;li&gt;How to resolve the issue caused when we miss the &lt;em&gt;new&lt;/em&gt; keyword&lt;/li&gt;
&lt;li&gt;More on Es5 constructor pattern&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  1. What is the new keyword in constructor instantiation
&lt;/h2&gt;

&lt;p&gt;The &lt;em&gt;new&lt;/em&gt; keyword in JavaScript is used to create an instance of a constructor. In other words, a new keyword helps us to create a fresh variant of a constructor(either built-in constructors or custom defined constructors by we JavaScript developers).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code example&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const emmanuel = new Person({name:"Emmanuel"});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. What happens if we don't use the &lt;em&gt;new&lt;/em&gt; keyword during constructor instantiation
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Before answering the second question, i will like to breakdown in simple steps what the new keyword &lt;em&gt;causes&lt;/em&gt; JavaScript to do to its &lt;em&gt;constructor&lt;/em&gt; behind the hood:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;A dunder/dondo&lt;code&gt;(__proto__)&lt;/code&gt; object gets created&lt;/li&gt;
&lt;li&gt;The dunder&lt;code&gt;(__proto__)&lt;/code&gt; object will inherit the content of the constructor prototype&lt;/li&gt;
&lt;li&gt;And finally, the &lt;code&gt;this&lt;/code&gt; global object of the constructor will now inherit from the dunder&lt;code&gt;(__proto__)&lt;/code&gt; object&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Code example&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; function Linkedin() {
   if (!new.target) return new arguments.callee();

 /***********************************
  * When you instantiate this constructor
  * with the new keyword, the below steps
  * gets executed like a magic 🪄:
  *
  * STEP 1: a dunder object is created:
  *       const __proto__ = {}
  *
  * STEP 2: the dunder object inherits
  * from constructor prototype
  *       Object.assign(__proto__,
  * Object.create(Linkedin.prototype))
  *
  * STEP 3: the "this" object inherits from the dunder object
  *     Object.assign(this,__proto__)
  *
  * Sumary of what happens behind the hood, i will use Es6 
  * for this summary so you understand better:
  *
  *     const __proto__={
  *             ...Component.prototype
  *       } /*Hey, do you know i am the new object which 
  * can only be accessible by my Constructor instance 
  * e.g new Func().__proto__*/
  *
  *    (function transferDunderToThis(){
  *       for(const prop in __proto__){
  *            this[prop] =__proto__[prop]
  *         }
  *     })()
  ****************************************/

  //private variables in es5
  const features = ['CAN_POST', 'CAN_CHAT'];

  //public methods in es5
  Linkedin.prototype.getFeatures = function getFeatures() {
    return features;
  };
}

const linkedin = Linkedin();

console.log(linkedin.getFeatures());// [ 'CAN_POST', 'CAN_CHAT' ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Now back to question 2, this is what happens if we don't use the "new" keyword during constructor instantiation&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;New &lt;code&gt;__proto__&lt;/code&gt; object is prevented from being created&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Because &lt;code&gt;__proto__&lt;/code&gt; object is not created, it &lt;em&gt;doesn't get binded&lt;/em&gt; or inherits from &lt;code&gt;Component.prototype&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Because &lt;code&gt;__proto__&lt;/code&gt; object is not created, the &lt;code&gt;this&lt;/code&gt; object automatically has nothing related to our constructor to be returned/consumed&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. How to resolve the issue caused when we miss the &lt;code&gt;new&lt;/code&gt; keyword during constructor instantiation
&lt;/h2&gt;

&lt;p&gt;The solution i use personally is to detect if new was used, if not return i then instatiate the constructor using its declaration signature(that is, if its expecting argument a, i will just pass down the argument like a parameter 😄) if need be. Just like below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
function Linkedin() {
  if (!new.target) return new arguments.callee();// so here is the magic
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. More on Es5 constructor pattern
&lt;/h2&gt;

&lt;p&gt;For more on Es5 patterns, checkout my &lt;a href="https://codesandbox.io/s/core-javascript-object-oriented-programming-dmmov" rel="noopener noreferrer"&gt;eBook&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Everything you need to know about var, let and const.</title>
      <dc:creator>Emmanuel Chikwendu Onah</dc:creator>
      <pubDate>Wed, 05 Jan 2022 04:31:09 +0000</pubDate>
      <link>https://forem.com/emmanuelonah/everything-you-need-to-know-about-var-let-and-const-56a5</link>
      <guid>https://forem.com/emmanuelonah/everything-you-need-to-know-about-var-let-and-const-56a5</guid>
      <description>&lt;h2&gt;
  
  
  Key points used in this article
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Scope:&lt;/strong&gt; Refers to a lexical environment at which variables and functions (be it expression or statement) are declared and made accessible as precedence.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hoisting:&lt;/strong&gt; A mechanism used by the JavaScript engine to take all variables and function declarations to the top of their respective scopes. If an engine supports JIT compilation, then it's in the JIT compilation phase that hoisting happens else during interpretation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Things to know about var
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;var is global and function scoped based only, e.g:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0gk3g24oq23dhyi09m64.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0gk3g24oq23dhyi09m64.png" alt=" " width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;var allows variable redeclaration(which doesn't make sense) and redefinition(which makes sense) within a singular scope, e.g:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fps0wtyercvbggh69jtcl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fps0wtyercvbggh69jtcl.png" alt=" " width="800" height="538"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;during hoisting, if a variable is accessed before its declarations as var variable, the compiler will hoist the var variable to the top of its scope with an implicit value of undefined, e.g:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4m68gbqwsom70d7bzcsm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4m68gbqwsom70d7bzcsm.png" alt=" " width="800" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;var variables declared inside block scope like if-statement, loops are not scoped meaning they can be accessed outside the block. e.g:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7w0fbdecce9v0t18pt1j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7w0fbdecce9v0t18pt1j.png" alt=" " width="800" height="276"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Things to know about let
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;let is global, and block(anything with { }) scoped e.g:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9fylkunuxo8pjroeb9si.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9fylkunuxo8pjroeb9si.png" alt=" " width="800" height="453"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;let doesn't allow redeclaration within a singular scope but allows redefinition, e.g:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flfb9ah2nehs13zsh3b3r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flfb9ah2nehs13zsh3b3r.png" alt=" " width="800" height="311"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;during hoisting, if a let variable is accessed before the declaration, the compiler throws a Reference error, unlike the var where an undefined value will be implicitly assigned, e.g:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9oxawp4397pttlfpdl2c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9oxawp4397pttlfpdl2c.png" alt=" " width="800" height="261"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Things to know about const
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;const has the same features as the let above. The only difference is that its read-only and doesn't allow redefinition, but allows mutation for objects(e.g obj.propertyOrMethod =newValue ) if not frozen(Object.freeze(obj)) e.g:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjy950tfbilrmy3yhp7dm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjy950tfbilrmy3yhp7dm.png" alt=" " width="800" height="960"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In conclusion, var, let and const is not bad in my opinion it just depends on how you understand your program, but rarely do we use var this day.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Core OOP in JavaScript</title>
      <dc:creator>Emmanuel Chikwendu Onah</dc:creator>
      <pubDate>Sat, 15 May 2021 11:10:02 +0000</pubDate>
      <link>https://forem.com/emmanuelonah/core-oop-in-javascript-463f</link>
      <guid>https://forem.com/emmanuelonah/core-oop-in-javascript-463f</guid>
      <description>&lt;p&gt;Hello,&lt;br&gt;
I just released the first phase of my JavaScript eBook titled &lt;strong&gt;Core OOP in JavaScript&lt;/strong&gt;, with respect to JavaScript as a prototyped based language. Go check it out here: &lt;a href="https://lnkd.in/eF6mVQv" rel="noopener noreferrer"&gt;https://lnkd.in/eF6mVQv&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;NB: read the docs to find your way around!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>oop</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Clarification of Typescript and JavaScript with respect to the mathematical term Set</title>
      <dc:creator>Emmanuel Chikwendu Onah</dc:creator>
      <pubDate>Thu, 04 Feb 2021 05:54:21 +0000</pubDate>
      <link>https://forem.com/emmanuelonah/clarification-of-typescript-and-javascript-with-respect-to-the-mathematical-term-set-2da9</link>
      <guid>https://forem.com/emmanuelonah/clarification-of-typescript-and-javascript-with-respect-to-the-mathematical-term-set-2da9</guid>
      <description>&lt;p&gt;Hello Js Community,&lt;/p&gt;

&lt;p&gt;Today we will be going theoretical and mathematical. It's quite unfortunate of how the downgrading/explanation of JavaScript has become since the release of Typescript due to the misinterpretation of the major keyword in Typescript definition "SUPERSET".&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Table of Content

1. Mathematical Set
2. Mathematical SuperSet
3. Mathematical SubSet
4. Javascript as a SubSet
5. Typescript as a SuperSet
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Before I proceed, I will love to remind you that the mastermind behind computer science is mathematics and will always remain mathematics, so it's good to go mathematical when you fall into confusion in computer science.&lt;/p&gt;

&lt;h3&gt;
  
  
  1.Mathematical Set
&lt;/h3&gt;

&lt;p&gt;In mathematics,a Set is a single collection of a distinct element,it can be string, numbers, flowers etc 😊. &lt;/p&gt;

&lt;p&gt;In JavaScript Programming, a Set is an object of distinct keys, and mind you the distinct keys can have the same value as their sibling key.&lt;/p&gt;




&lt;h3&gt;
  
  
  2.Mathematical SuperSet
&lt;/h3&gt;

&lt;p&gt;In mathematics,we say A is a SuperSet of B when all B elements are present in A set.&lt;/p&gt;

&lt;p&gt;In JavaScript Programming (lets key the class aside), we say object A is a SuperObject of object B when Object A has a complete extension of object B properties either by spreading, using the Object constructor which makes the object unenumerable(like Object.property or Object.properties, or Object.create), or &amp;amp; symbol.&lt;/p&gt;




&lt;h3&gt;
  
  
  3.Mathematical SubSet
&lt;/h3&gt;

&lt;p&gt;In mathematics,we say B is a SubSet of A when all B elements exist in A set but A primary element doesn't exist in B Set. On the other hand, B makes up the existence of A but B exists without A.&lt;/p&gt;

&lt;p&gt;In JavaScript Programming, we say Object B is SubObject of Object A when all the properties of Object B exist in Object A but the primary properties of A don't exist in Object B. Meaning Object B enables the existence of Object A.&lt;/p&gt;




&lt;h3&gt;
  
  
  4.JavaScript as a Subset of Typescript
&lt;/h3&gt;

&lt;p&gt;I will like to conclude that from the mathematical representation, JavaScript enabled the existence of Typescript which we both know and that's why everything javascript gets transpile to javascript and shipped as javascript except interface which has no representation in Javascript(the interface is a good example of SuperSet primary element not being present in Subset)&lt;/p&gt;




&lt;h3&gt;
  
  
  5.Typescript as a Superset of Javascript
&lt;/h3&gt;

&lt;p&gt;I will like to draw a simple conclusion from the mathematical standard, that there can be no SuperSet without SubSet as such there can be no reason why Typescript exists if not for Javascript.&lt;/p&gt;




&lt;p&gt;So in a nutshell, Typescript and Javascript is a mathematical representation of SuperSet and SubSet. So I hope from now you start looking at this two Combinatorics as turn-around for Js community and not the other way round, if you are coming from a primarily-typed-language like me i am certain you know what I am talking ☕️😀🍻&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ff1m2jh3ml0wi9oa99we9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ff1m2jh3ml0wi9oa99we9.png" alt="Alt Text" width="800" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Main differences between the two common ways of passing in a functional based prop-value in React with respect to buttons.</title>
      <dc:creator>Emmanuel Chikwendu Onah</dc:creator>
      <pubDate>Sun, 31 Jan 2021 05:21:09 +0000</pubDate>
      <link>https://forem.com/emmanuelonah/main-differences-between-the-two-common-ways-of-passing-in-a-functional-based-prop-value-in-react-with-respect-to-buttons-359a</link>
      <guid>https://forem.com/emmanuelonah/main-differences-between-the-two-common-ways-of-passing-in-a-functional-based-prop-value-in-react-with-respect-to-buttons-359a</guid>
      <description>&lt;p&gt;Note: for this article, we will be using the button and its onClick property aka attribute or prop.&lt;/p&gt;

&lt;p&gt;The main difference between passing in a function to be executed on an operation based(e.g: on button click) and invoking it to executed at render time in React is that "one waits for an action to execute it" and "one executes itself at render time" e.g:  &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   &amp;lt;button onClick ​={func()}&amp;gt;Button&amp;lt;/button&amp;gt; : this will execute at render time then the essence of click event will be abused which is not what you want. 

   &amp;lt;button onClick ​={func}&amp;gt;Button&amp;lt;/button&amp;gt; : this will be executed when a button click is triggered.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Note: this is a pure JavaScript thingy and has nothing to do with react.&lt;/p&gt;

&lt;p&gt;This is a similar behavior below:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2qa3iklhy2ha1g77cl02.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2qa3iklhy2ha1g77cl02.png" alt="Alt Text" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;To rewrite this &amp;lt;button onClick ​={func()}&amp;gt;Button&amp;lt;/button&amp;gt; in the case of  legacy code:

&amp;lt;button onClick ​={()=&amp;gt;func()}&amp;gt;Button&amp;lt;/button&amp;gt; /***what is actually happening here is pure javascript logic which means:

1. A function can only run when its invoked and the anonymous  function of the button which is “()=&amp;gt;” will only run when the invoker(the click event is the invoker) invokes it.
2. It's only when a function is invoked that the internal operation will be executed, meaning it's only when the anonymous function runs that it will execute the "func()".**/


So thank you for stopping to read this ☕️ 👨🏿‍💻🙂
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Meanwhile let me give you a little clue as my appreciated follower: So i haven't been releasing articles for a while now because i started contributing to an open-source javascript/react library during my freetimes/weekends after work. So the clue is that,you should get ready to use alot of wonderful and mighty open-sourced projects which will be coming your way soon from "elegant-ui library" a library with contributors from Sony-ericsson, check24,Twilio,myself and....🍾 🍻&lt;/p&gt;

</description>
    </item>
    <item>
      <title>DAY 3 of building the Higher Order Functions in Javascript. the find Higher Order Function.</title>
      <dc:creator>Emmanuel Chikwendu Onah</dc:creator>
      <pubDate>Wed, 06 Jan 2021 23:19:45 +0000</pubDate>
      <link>https://forem.com/emmanuelonah/day-3-of-building-the-higher-order-functions-in-javascript-the-find-higher-order-function-24l4</link>
      <guid>https://forem.com/emmanuelonah/day-3-of-building-the-higher-order-functions-in-javascript-the-find-higher-order-function-24l4</guid>
      <description>&lt;p&gt;Hello  community,&lt;/p&gt;

&lt;p&gt;today we will be implementing the find Higher Order Function.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//find function
/********************
 *@_find prototype is a javascript higher order function   that returns the first value that mets the condition i.e it takes it out of the prepended array because tnen its no more a  collection but rather just a singular value
 *@_find takes in a callback function
 *@callback: the callback takes in the finded value,index     of the finded value,the array
 *@author: Emmanuel Onah
 ********************/

Array.prototype._find = function(callback){
  for(let i = 0; i &amp;lt; this.length;i++){
     const expectedValue = callback(this[i],i,this);

     /*if the index is found i.e expected value exist in   the array, then return it and break        out.Note: i did not  use the break keyword because it will then be redundant in the   scope of return keyword but outside the scope of return  keyword you can use the break keyword.
      */
       if(expectedValue){
          const indexOfExpectedValue =     this.indexOf(this[i]);
   return this[indexOfExpectedValue];
   }
 }
 //if user computation is invalid, then lets just return   the function operation.
 return;
}

const names =  ["Jerry","Jude","Joe","CreativeDams","SashaBlanca"];
//test
const newValue = names._find((name,index,names)=&amp;gt;name.length &amp;gt; 3);
console.log(newValue);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh2y28jlibkncjmcb6izc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh2y28jlibkncjmcb6izc.png" alt="Alt Text" width="800" height="596"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/emmanuelonah/day-1-of-building-the-higher-order-functions-in-javascript-the-map-higher-order-function-4b17"&gt;Day 1: the map array prototype&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/emmanuelonah/day-2-of-building-the-higher-order-functions-in-javascript-the-filter-higher-order-function-56ld"&gt;Day 2: the filter array prototype&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/emmanuelonah/day-4-of-building-the-higher-order-functions-in-javascript-the-reduce-higher-order-function-643"&gt;Day 4: The reduce prototype&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>DAY 2 of building the Higher Order Functions in javascript. the filter Higher Order Function.</title>
      <dc:creator>Emmanuel Chikwendu Onah</dc:creator>
      <pubDate>Wed, 06 Jan 2021 02:23:52 +0000</pubDate>
      <link>https://forem.com/emmanuelonah/day-2-of-building-the-higher-order-functions-in-javascript-the-filter-higher-order-function-56ld</link>
      <guid>https://forem.com/emmanuelonah/day-2-of-building-the-higher-order-functions-in-javascript-the-filter-higher-order-function-56ld</guid>
      <description>&lt;p&gt;Hello community,&lt;/p&gt;

&lt;p&gt;So today we will be implementing the filter HOF.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//filter function
/******************
*@_filter prototype is an array prototype that returns a new array from the prepended array(or better still the object)  that met the condition
*@_filter prototype takes in a callback function
*@callback arguments:the iterated-value,the iterated-  index,the prepended array itself
*@author Emmanuel Onah
******************/

Array.prototype._filter = function(callback){
   const newArray = [];

   for(let i = 0; i &amp;lt; this.length;i++){
       const fullfilledValue = callback(this[i],i,this);
       if(fullfilledValue){
          newArray.push(this[i]);
    }
} 
 return newArray;
}
const names= ["Jerry","Joe","Jude","SashaBlanca"];
//testing 1
const newArray1 =    names._filter((name,nameIndex,arr)=&amp;gt;name.length===3);
console.log(newArray1);


//testing 2
const newArray2 = names._filter((name,nameIndex,arr)=&amp;gt;name.includes("Sa"));
console.log(newArray2);

//testing 3
const newArray3 = names._filter((name,nameIndex,arr)=&amp;gt;name.length &amp;lt;=5);
console.log(newArray3);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fiopfk1vv8674x3g8emir.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fiopfk1vv8674x3g8emir.png" alt="Alt Text" width="800" height="625"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/emmanuelonah/day-1-of-building-the-higher-order-functions-in-javascript-the-map-higher-order-function-4b17"&gt;Day 1: the map array prototype&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/emmanuelonah/day-3-of-building-the-higher-order-functions-in-javascript-the-find-higher-order-function-24l4"&gt;Day 3: the find array prototype&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/emmanuelonah/day-4-of-building-the-higher-order-functions-in-javascript-the-reduce-higher-order-function-643"&gt;Day 4: The reduce prototype&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>DAY 1 of building the Higher Order Functions in javascript. the map Higher Order Function.</title>
      <dc:creator>Emmanuel Chikwendu Onah</dc:creator>
      <pubDate>Tue, 05 Jan 2021 03:52:20 +0000</pubDate>
      <link>https://forem.com/emmanuelonah/day-1-of-building-the-higher-order-functions-in-javascript-the-map-higher-order-function-4b17</link>
      <guid>https://forem.com/emmanuelonah/day-1-of-building-the-higher-order-functions-in-javascript-the-map-higher-order-function-4b17</guid>
      <description>&lt;p&gt;Hello community,&lt;/p&gt;

&lt;p&gt;its been a while but i assure you this year contents gonna be lit 👨🏿‍💻🍺☕️.&lt;/p&gt;

&lt;p&gt;So today we will be implementing the map HOF.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//map function
/**********
* @prototype _map method
* @prototype _map takes in a callback function as an   argumanet
* @callbal function of _map prototype takes in the Array   function
* @author: Emmanuel Onah
**********/
Array.prototype._map = function(callback){
    const newArray = []
    for ( let i = 0; i &amp;lt; this.length;i ++){
         newArray.push(this[i]);
         callback(this[i],i,this);
   }
 }
 const names = ["Jerry","Joe","Jack","sashaBlanca"];
 const newMappedArray =     names._map((eachArrayVal,index,array)=&amp;gt;{
 console.log(eachArrayVal,index,array)
 });
 newMappedArray;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F04hwc7pmd3xd49e1a6v2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F04hwc7pmd3xd49e1a6v2.png" alt="Alt Text" width="800" height="639"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/emmanuelonah/day-2-of-building-the-higher-order-functions-in-javascript-the-filter-higher-order-function-56ld"&gt;Day 2: The filter array prototype&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/emmanuelonah/day-3-of-building-the-higher-order-functions-in-javascript-the-find-higher-order-function-24l4"&gt;Day 3: The find array prototype&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/emmanuelonah/day-4-of-building-the-higher-order-functions-in-javascript-the-reduce-higher-order-function-643"&gt;Day 4: The reduce prototype&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Dynamically Validate Form Input Using RegExp and Object Evaluator | RegExp | Form Validation</title>
      <dc:creator>Emmanuel Chikwendu Onah</dc:creator>
      <pubDate>Tue, 29 Sep 2020 05:03:02 +0000</pubDate>
      <link>https://forem.com/emmanuelonah/how-to-dynamically-validate-form-input-using-regexp-and-object-evaluator-regexp-form-validation-44a7</link>
      <guid>https://forem.com/emmanuelonah/how-to-dynamically-validate-form-input-using-regexp-and-object-evaluator-regexp-form-validation-44a7</guid>
      <description>&lt;p&gt;Welcome to my dynamic form validation tutorial using object evaluator.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; this tutorial is not for RegExp but to help you understand the best use case of “[ ]” to access object properties.&lt;/p&gt;

&lt;p&gt;Quick information: there are two possible ways to access an object which includes:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;objName.objProperty
objName[objProperty]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;But the question here is what is the best use case?&lt;/p&gt;

&lt;p&gt;The answer is: use the "dot" syntax when you want to access a property directly(that is static) and use the square bracket when you want to access a property dynamically. Dynamically means the property to be accessed changes as the user changes the value. E.g:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const STAFF_NAMES ={
      staffOne:”CreativeAdams”,
      staffTwo:”CreativePerete”,
      staffThree:”CreativeJerry”
}

const getStaffName=staffKey=&amp;gt;{
   return STAFF_NAMES[staffKey]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Below example is simply one of the dynamic ways to access properties
&lt;/h2&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;getStaffName(“staffOne”);//CreativeAdams 
getStaffName(“staffTwo”);//CreativePerete
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Link to the complete code on how to dynamically validate your form using RegExp and object evaluator syntax.&lt;br&gt;
&lt;a href="https://codepen.io/CreativeJerry/pen/WNwWmBz" rel="noopener noreferrer"&gt;Click Me&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Quick note: the form validation could be performed in many ways e.g: &lt;br&gt;
By validating each of the inputs which is a pain to developers.&lt;br&gt;
By Looping through the inputs element and accessing their type or name, then deciding on the validation. But I bet you, that will cause a time-complexity issue.&lt;br&gt;
The best solution is provided here by me: &lt;a href="https://codepen.io/CreativeJerry/pen/WNwWmBz" rel="noopener noreferrer"&gt;Click Me&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Explanation
&lt;/h2&gt;

&lt;p&gt;The most important thing inside the code is at &lt;strong&gt;line 13&lt;/strong&gt;, that’s where the evaluation and validation happens. &lt;/p&gt;

&lt;p&gt;So this &lt;strong&gt;RegExp[e.target.name]&lt;/strong&gt; is what enables the dynamism. This is a javascript syntax for &lt;strong&gt;object/variable evaluation&lt;/strong&gt;. Also, if you are from React community you definitely have come across &lt;em&gt;dynamic input value-handling to state&lt;/em&gt; by simply doing this:&lt;br&gt;
this.setState({…this.state,&lt;/p&gt;

&lt;p&gt;///So this is simply same thing(evaluation).&lt;/p&gt;

&lt;p&gt;Thanks and have a wonderful day.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>html</category>
    </item>
    <item>
      <title>Must Read Article for Every Frontend Engineer</title>
      <dc:creator>Emmanuel Chikwendu Onah</dc:creator>
      <pubDate>Wed, 16 Sep 2020 16:15:59 +0000</pubDate>
      <link>https://forem.com/emmanuelonah/most-read-article-for-every-frontend-engineer-4oa8</link>
      <guid>https://forem.com/emmanuelonah/most-read-article-for-every-frontend-engineer-4oa8</guid>
      <description>&lt;p&gt;Hello mate,&lt;/p&gt;

&lt;p&gt;In this article, we will be looking into the most important processes a frontend developer should know apart from writing code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Content
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;HTTP&lt;/li&gt;
&lt;li&gt;HTTP/HTTPS Scheme&lt;/li&gt;
&lt;li&gt;URI&lt;/li&gt;
&lt;li&gt;URL&lt;/li&gt;
&lt;li&gt;SSL/TLS&lt;/li&gt;
&lt;li&gt;CORS with respective to environment target development.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  1. HTTP(Hypertext Transfer Protocol):
&lt;/h2&gt;

&lt;p&gt;this is simply a set of network principles placed between a browser and a server where a data is located, which allows transport of hypermedia (hypermedia document are images, videos, graphics, audio, plain text…) documents between the two environments(browser and server).  In summary, &lt;em&gt;HTTP&lt;/em&gt; is a network protocol lying between a browser and a server for the purpose of allowing the transfer of hypermedia documents if the set-aside protocols are abided.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. HTTP/HTTPS Scheme:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  HTTP Scheme:
&lt;/h3&gt;

&lt;p&gt;This is part of a URI(Uniform Resource Identifier e.g  &lt;a href="http://youmustknowjs.com/article" rel="noopener noreferrer"&gt;http://youmustknowjs.com/article&lt;/a&gt;) that decides the security state at which your resources are been transported to the server through a network connection. Any website with Http scheme is at risk because any resources from the website get transported un an unencrypted connection.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; Http scheme is different from the first HTTP we spoke about. This one is in-charge of applying security protocols to a website resource because of data-bridge.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;In summary,&lt;/em&gt; the Http scheme is responsible for encrypting all your resources on a network because you need a network connection to perform server operations. And if you notice, you always get a warning when visiting a URL with Http scheme and not https scheme(we will talk about https scheme in the next session).&lt;/p&gt;

&lt;h3&gt;
  
  
  HTTPS Scheme:
&lt;/h3&gt;

&lt;p&gt;This is the https you see prefixed on every URI/URL and what this does, is to ensure that your resource transportation is encrypted(anonymised) via a network connection.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;In summary&lt;/em&gt;, do not provide sensible data on a website with HTTP Scheme. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;General Information for Companies or website owners:&lt;/em&gt; Unfortunately, the recent security update by chrome broke a lot of HTTPS configuration on many websites(and this is  likely to be a proxy related issue)&lt;/p&gt;




&lt;h2&gt;
  
  
  3. URI(Uniform Resource Identifier):
&lt;/h2&gt;

&lt;p&gt;This is a string of characters full of foo bar baz 😃&lt;br&gt;
(Don’t mind me I love the word foo bar baz because my mentor uses it a lot &lt;a href="https://www.linkedin.com/in/getify/" rel="noopener noreferrer"&gt;Kyle Simpson&lt;/a&gt;). So, a URI is simply a string of characters used to identify your resources(in other words your website or server….). For example &lt;a href="https://i-am-a-resource-identier.com" rel="noopener noreferrer"&gt;https://i-am-a-resource-identier.com&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  But what’s the ambilguousity of URI?
&lt;/h4&gt;

&lt;p&gt;It has many ambiguous statements which often gets confused or interchanged with the URL(Uniform Resource Locator). &lt;/p&gt;

&lt;h2&gt;
  
  
  Clarification of the Ambilguousity of URI
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;URI:&lt;/em&gt; from the name identifier it tells it all. Look at this as a name used to identify someone in school. But if I may ask you, if you know the name of a person does it grantee you finding the person’s home or house? The answer is no because you will need an address and that is what a URL provides and not a URI.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. URL: from the name It tells it all “locator”. This is like a home address for locating resources wherever its located.
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;In summary,&lt;/em&gt; a URL can serve as both URI and URL but URI can-never play both role.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. SSL(Secure Sockets layer)/TLS(Transport Layer Security): This is a layer that lay on &lt;em&gt;https&lt;/em&gt; scheme, and this is what enables the &lt;em&gt;encryption(anonymization)&lt;/em&gt; of your resources transported between your browser and server. &lt;em&gt;Note&lt;/em&gt;, &lt;strong&gt;TLS&lt;/strong&gt; is just an upgraded version of &lt;strong&gt;SSL&lt;/strong&gt; and this is what differentiates the &lt;strong&gt;Http(unsecured) scheme and Https(secured) scheme&lt;/strong&gt;.
&lt;/h2&gt;

&lt;h2&gt;
  
  
  6. CORS(Cross-Origin Resource Sharing):
&lt;/h2&gt;

&lt;p&gt;This a mechanism manually built into the server and automatically built into every browser that tells if a resource should be shared between servers. For Examples: The CORS Mechanism tells if:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;There should be a resource sharing between your local server(&lt;a href="http://localhost:8080" rel="noopener noreferrer"&gt;http://localhost:8080&lt;/a&gt;) and a live server (e.g: a live backend server hosted on &lt;a href="https://example.digital-ocean.com" rel="noopener noreferrer"&gt;https://example.digital-ocean.com&lt;/a&gt;)&lt;/li&gt;
&lt;/ol&gt;




&lt;ol&gt;
&lt;li&gt;There should be a resource sharing from one server to another e.g: frontend is hosted on &lt;a href="https://sample1.com" rel="noopener noreferrer"&gt;https://sample1.com&lt;/a&gt; and backend is hosted on &lt;a href="https://sample2.com" rel="noopener noreferrer"&gt;https://sample2.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;ol&gt;
&lt;li&gt;There should be a resource sharing between resources of different protocol e.g: secured protocol(&lt;a href="https://sample.com" rel="noopener noreferrer"&gt;https://sample.com&lt;/a&gt;) and unsecured protocol(&lt;a href="http://sample.com" rel="noopener noreferrer"&gt;http://sample.com&lt;/a&gt;)&lt;/li&gt;
&lt;/ol&gt;




&lt;ol&gt;
&lt;li&gt;There should be a resource sharing between servers running on a different port&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;So, its the CORS mechanism that allows all of these operations and if the CORS mechanism set or designed by the backend doesn’t allow a certain connection or operation from a specific URL, then that operation will never succeed and that’s why most frontend developers have to contact the backend engineers to add some certain locators to the CORS mechanism.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;In summary,&lt;/em&gt; if you noticed, most APIs have their initial directory similar to the frontend locator e.g a frontend locator might be &lt;a href="https://myserver.com" rel="noopener noreferrer"&gt;https://myserver.com&lt;/a&gt; and the API locator will be &lt;a href="https://myserver.com/api/" rel="noopener noreferrer"&gt;https://myserver.com/api/&lt;/a&gt;. So the idea here is that, they are located on the same server but the API is located on a sub-directory called “/api” and this is similar to navigation to about or home page.&lt;/p&gt;

&lt;h4&gt;
  
  
  So what Next?
&lt;/h4&gt;

&lt;p&gt;Hmmm from my end, I will say this is an intro to networking and networking is a little bit related to cloud computing and cloud computing is the present and the future and that’s my passion(web &amp;amp; cloud computing). &lt;/p&gt;

&lt;p&gt;So stay tuned I will be releasing an article on an intro to web and cloud computing and why its the present and  future of data management and storage e.g distribution systems **Horizontal scaling.&lt;/p&gt;

&lt;p&gt;Meanwhile, you can follow me on instagram where i plan to start releasing a quick daily updates &amp;amp; tips on web development and Javascript + its ecosystem &lt;a href="https://www.instagram.com/emmanuelonahafriclite/" rel="noopener noreferrer"&gt;Follow me&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>javascript</category>
      <category>html</category>
    </item>
  </channel>
</rss>
