<?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>DEV Community: Chuks Festus</title>
    <description>The latest articles on DEV Community by Chuks Festus (@chuksfestus).</description>
    <link>https://dev.to/chuksfestus</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%2F68998%2F25eecd16-51af-4ce6-a46b-a923a57cd262.png</url>
      <title>DEV Community: Chuks Festus</title>
      <link>https://dev.to/chuksfestus</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chuksfestus"/>
    <language>en</language>
    <item>
      <title>static type JavaScript</title>
      <dc:creator>Chuks Festus</dc:creator>
      <pubDate>Sat, 22 Jun 2019 19:40:48 +0000</pubDate>
      <link>https://dev.to/chuksfestus/static-type-javascript-1hn5</link>
      <guid>https://dev.to/chuksfestus/static-type-javascript-1hn5</guid>
      <description>&lt;p&gt;Has anyone used both flow and typescript? After trying graphql I'm sold on this whole type system and don't know which to go for. Typescript has a lot of hype though but is it really just hype or is it as great as people make it seem.&lt;/p&gt;

&lt;p&gt;PS: I don't use vscode so saying one  has a great support for it doesn't do it for me, I'm a sublime person&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>flow</category>
      <category>discuss</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Using Javascript Arrow Functions</title>
      <dc:creator>Chuks Festus</dc:creator>
      <pubDate>Mon, 20 Mar 2017 19:44:47 +0000</pubDate>
      <link>https://dev.to/chuksfestus/using-javascript-arrow-functions-4ho8</link>
      <guid>https://dev.to/chuksfestus/using-javascript-arrow-functions-4ho8</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2A9s_UE0CM6cz2XJq8CTf29w.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2A9s_UE0CM6cz2XJq8CTf29w.jpeg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Classical JavaScript function syntax doesn’t provide for any flexibility, be that a 1 statement function or an unfortunate multi-page function. Every time you need a function you have to type out the dreaded function () {}. To me it was a serious pain especially after working with coffeescript. But thank God!! the maintainers of Javascript decided to save the day and gave us &lt;strong&gt;&lt;em&gt;the fat arrow&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Arrow functions also called “fat arrow” functions are a more concise syntax for writing function expressions. They utilize a new token, =&amp;gt;, that looks like a fat arrow. Arrow functions are anonymous and change the way this binds in functions.&lt;/p&gt;

&lt;p&gt;By using arrow function we avoid having to type the function keyword, return keyword (it’s implicit in arrow functions), and curly brackets.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using Arrow Functions
&lt;/h3&gt;

&lt;p&gt;Two factors influenced the introduction of arrow functions: shorter functions and non-binding of this.&lt;/p&gt;

&lt;h4&gt;
  
  
  Shorter functions
&lt;/h4&gt;

&lt;p&gt;Let’s compare how ES5 code with function expressions can now be written in ES6 using arrow functions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//ES5
add = function(x, y) {
    return x + y;
}
console.log(add(1,2)); // prints 3

//ES6
add = (x,y) =&amp;gt; x + y
console.log(add(1,2)); // prints 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Cool huh? The arrow function example above allows a developer to accomplish the same result with fewer lines of code and approximately half of the typing. The syntax for arrow functions comes in many flavors depending upon what you are trying to accomplish, that is both the arguments and the body can take different forms depending on usage. For example, the following arrow function takes a single argument and simply returns it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// ES6:

let arrowFunc = value =&amp;gt; value;

// ES5:

var reflect = function(value) {
    return value;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When there is only one argument for an arrow function, that one argument can be used directly without any further syntax. Similarly, a function without any named arguments must use empty parentheses to start the arrow function declaration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// ES6:

let add = () =&amp;gt; 1 + 2;

// ES5:

let add = function() {
    return 1 + 2;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Non-binding of this
&lt;/h4&gt;

&lt;p&gt;Until arrow functions, every new function defined its own &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this" rel="noopener noreferrer"&gt;this&lt;/a&gt; value, This proved to be annoying with an object-oriented style of programming. Since the value of this can change inside of a single function depending on the context in which it’s called, it’s possible to mistakenly affect one object when you meant to affect another. Consider this example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function Person() {
  // The Person() constructor defines `this` as an instance of itself.
  this.age = 0;

  setInterval(function growUp() {

    /\* In non-strict mode, the growUp() function defines `this` 
       as the global object, which is different from the `this`
       defined by the Person() constructor.\*/

    this.age++;
  }, 1000);
}

let p = new Person();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An arrow function does not create its own this context, so this has its original meaning from the enclosing context. Thus, the following code works as expected:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function Person(){
  this.age = 0;

  setInterval(() =&amp;gt; {
    this.age++; // |this| properly refers to the person object
  }, 1000);
}

let p = new Person();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Pitfalls of Arrow Functions
&lt;/h3&gt;

&lt;p&gt;The new arrow functions bring a helpful function syntax to ECMAScript, but as with any new feature, they come with their own pitfalls and gotchas. Here are a couple things you need to watch out for when using arrow functions.&lt;/p&gt;

&lt;h4&gt;
  
  
  More about this
&lt;/h4&gt;

&lt;p&gt;Since this is not bound in arrow functions, the methods call() or apply() can only pass in parameters. this is ignored. The value of this inside of a function simply can’t be changed–it will be the same value as when the function was called. If you need to bind to a different value, you’ll need to use a function expression.&lt;/p&gt;

&lt;h4&gt;
  
  
  No binding of arguments
&lt;/h4&gt;

&lt;p&gt;Arrow functions do not bind an arguments object. Thus, in this example, arguments is simply a reference to the same name in the enclosing scope:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let arguments = 42;
let arr = () =&amp;gt; arguments;

arr(); // 42

function foo() {
  let f = (i) =&amp;gt; arguments[0] + i; // foo's implicit arguments binding
  return f(2);
}

foo(1); // 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However using &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters" rel="noopener noreferrer"&gt;rest parameters&lt;/a&gt; is a good alternative to using an arguments object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function foo() { 
  let f = (...args) =&amp;gt; args[0]; 
  return f(2); 
}

foo(1); // 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Constructors
&lt;/h4&gt;

&lt;p&gt;Arrow functions cannot be used as &lt;a href="https://msdn.microsoft.com/en-us/library/c1hcx253(v=vs.94).aspx?WT.mc_id=16547-DEV-sitepoint-article83" rel="noopener noreferrer"&gt;constructors&lt;/a&gt; as other functions can. Don’t use them to create similar objects as you would with other functions. If you attempt to use new with an arrow function, it will throw an error. Arrow functions, like &lt;a href="https://msdn.microsoft.com/en-us/library/c6hac83s(v=vs.94)?WT.mc_id=16547-DEV-sitepoint-article83" rel="noopener noreferrer"&gt;built-in functions&lt;/a&gt; (aka methods), don’t have a prototype property or other internal methods. Because constructors are generally used to create classlike objects in JavaScript, you should use the new &lt;a href="https://medium.com/papdit/understanding-es6-classes-ada7c14e0213#.yfek9qnac" rel="noopener noreferrer"&gt;ES6 classes &lt;/a&gt;instead.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Arrow functions are an interesting new feature in ECMAScript 6, and one of the features that is pretty solidified at this point in time. As passing functions as arguments has become more popular, having a concise syntax for defining these functions is a welcome change to the way we’ve been doing this forever. The lexical this binding solves a major painpoint for developers and has the added bonus of improving performance through JavaScript engine optimizations.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>es6</category>
    </item>
    <item>
      <title>Understanding ES6 Classes</title>
      <dc:creator>Chuks Festus</dc:creator>
      <pubDate>Fri, 17 Mar 2017 11:28:42 +0000</pubDate>
      <link>https://dev.to/chuksfestus/understanding-es6-classes-4nkk</link>
      <guid>https://dev.to/chuksfestus/understanding-es6-classes-4nkk</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F700%2F1%2AyiS2QvVKIpYCb0fqvrsXZQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F700%2F1%2AyiS2QvVKIpYCb0fqvrsXZQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Under the hood, es6 class are not something that is radically new: they are just syntactic sugar over the prototype-based behavior delegation capabilities we’ve had all along. This does make the code more readable and lays the path forward for new Object Oriented (OO) features in the upcoming spec releases.&lt;/p&gt;

&lt;h3&gt;
  
  
  Defining Classes
&lt;/h3&gt;

&lt;p&gt;Let’s refresh our memory and look at a typical way of wiring OO code in ES5.&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;person&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;dob&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;defineProperty&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;defineProperty&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dob&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;dob&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prototype&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&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;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dob&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;person&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;person&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Chuks Festus&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2017&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Chuks Festus&lt;/span&gt;
&lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;John Doe&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="c1"&gt;// Chuks Festus 2017&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pretty simple huh? we’ve defined a peron class with two read only properties and a custom toString method. Lets do the same thing in ES6.&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;class&lt;/span&gt; &lt;span class="nc"&gt;person&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;dob&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nx"&gt;_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nx"&gt;_year&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;year&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="nf"&gt;make&lt;/span&gt;&lt;span class="p"&gt;()&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;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nx"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="nf"&gt;year&lt;/span&gt;&lt;span class="p"&gt;()&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;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nx"&gt;_dob&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}${&lt;/span&gt;&lt;span class="nx"&gt;thi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dob&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;person&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;person&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;chuks festus&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2017&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Chuks Festus&lt;/span&gt;
&lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;John Doe&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="c1"&gt;// Chuks Festus 2017&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So lets try breaking it down:&lt;/p&gt;

&lt;h3&gt;
  
  
  Defining Classes
&lt;/h3&gt;

&lt;p&gt;Just like functions, there are two ways to define a class in javascript: &lt;strong&gt;Class expression&lt;/strong&gt; and &lt;strong&gt;class declaration&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Class Declaration
&lt;/h4&gt;

&lt;p&gt;To declare a class, you use the classkeyword with the name of the class&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;class&lt;/span&gt; &lt;span class="nc"&gt;person&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One important thing to note here is that unlike function declarations, class declarations can’t be hoisted. You first need to declare your class and then access it, otherwise you get a ReferenceError:&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;let&lt;/span&gt; &lt;span class="nx"&gt;chuks&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;person&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// ReferenceError&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;person&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Class expressions
&lt;/h4&gt;

&lt;p&gt;A &lt;strong&gt;class expression&lt;/strong&gt; is another way to define a class. Class expressions can be named or unnamed. The name given to a named class expression is local to the class’s body.&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="c1"&gt;//unnamed&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;person&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="err"&gt;{
    &lt;/span&gt;&lt;span class="nc"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;//named &lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;person&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;person&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;constructor &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&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;p&gt;Its important to note that Class &lt;strong&gt;expressions&lt;/strong&gt; also suffer from the same hoisting issues mentioned for Class &lt;strong&gt;declarations&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Constructor
&lt;/h3&gt;

&lt;p&gt;The constructor method is a special method for creating and initializing an object created with a class. There can only be one special method with the name "constructor" in a class.&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;class&lt;/span&gt; &lt;span class="nc"&gt;person&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;constructor &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;dob&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dob&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;dob&lt;/span&gt;&lt;span class="p"&gt;;&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;h3&gt;
  
  
  Static Methods
&lt;/h3&gt;

&lt;p&gt;Static methods are often used to create utility functions for an application. In ES5 it looks like a basic property on a constructor function.&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;person&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

&lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;compare&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;b&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;p&gt;And the new shiny static syntax looks like this:&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;class&lt;/span&gt; &lt;span class="nc"&gt;person&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;static &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&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;p&gt;Static methods are called without instantiating their class and &lt;strong&gt;cannot&lt;/strong&gt; be called through a class instance.&lt;/p&gt;

&lt;p&gt;Under the covers, JavaScript is still just adding a property to the person constructor, it just ensures that the method is in fact static. Note that you can also add static value properties.&lt;/p&gt;

&lt;h3&gt;
  
  
  Extending Classes
&lt;/h3&gt;

&lt;p&gt;The extends keyword is used in &lt;em&gt;class declarations&lt;/em&gt; or &lt;em&gt;class expressions&lt;/em&gt; to create a class as a child of another class.&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;class&lt;/span&gt; &lt;span class="nc"&gt;person&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;dob&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt; &lt;span class="nx"&gt;year&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;year&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nf"&gt;make&lt;/span&gt;&lt;span class="p"&gt;()&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;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nx"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nf"&gt;year&lt;/span&gt;&lt;span class="p"&gt;()&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;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="nx"&gt;_dob&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}${&lt;/span&gt;&lt;span class="nx"&gt;thi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dob&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;gender&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;person&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
    &lt;span class="nf"&gt;male&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; is a dude&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;chuks&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;gender&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;chuks&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2017&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;chuks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;male&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Super class
&lt;/h3&gt;

&lt;p&gt;To call a parent constructor you simply use the super keyword as a function, eg super(name, dob). For all other functions, use super as an object, eg super.toString(). Here’s what the updated example looks like:&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;class&lt;/span&gt; &lt;span class="nc"&gt;Gender&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;person&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;male&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;();&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;p&gt;At this time, there isn’t any advantage to using classes over prototypes other than better syntax. However, it’s good to start developing a better practice and getting used to the new syntax. The tooling around JavaScript gets better every day and with proper class syntax you will be helping the tools help you.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>es6</category>
    </item>
    <item>
      <title>Getting Started With ES6 and Babel</title>
      <dc:creator>Chuks Festus</dc:creator>
      <pubDate>Tue, 14 Mar 2017 13:20:07 +0000</pubDate>
      <link>https://dev.to/chuksfestus/getting-started-with-es6-and-babel-2j91</link>
      <guid>https://dev.to/chuksfestus/getting-started-with-es6-and-babel-2j91</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AGMLD_bKgczsoj0tDBMAVsA.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AGMLD_bKgczsoj0tDBMAVsA.jpeg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ES6 (also known as ES2015) is an update of the javascript language which includes many new improvements.&lt;/p&gt;

&lt;p&gt;Over the years the javascript community has been “hacking” the language writing libraries and utilities to add useful features to the language. Prototype, jQuery, angularJs, underscore, Lodash, backbone and a galaxy of others have all helped to extend javascript’s capabilities. ES6 has incorporated many of these extensions as native features, meaning by writing modern javascript you may reduce your dependency on extra utility libraries.&lt;/p&gt;

&lt;p&gt;Let me show you how to get started!&lt;/p&gt;

&lt;h3&gt;
  
  
  Install Babel with ES2015 Addon
&lt;/h3&gt;

&lt;p&gt;We will start by installing the Babel CLI and a preset available as a package from NPM so we can use the new syntax addition:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save-dev babel-cli babel-preset-env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Babel has many addons for a variety of language modifications (like JSX) but this one addon is all we need to get started.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create a .babelrc File
&lt;/h3&gt;

&lt;p&gt;The small file allows us to create a preset for babel usage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "presets": ["env"]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point we have Babel installed and preferences set!&lt;/p&gt;

&lt;h3&gt;
  
  
  Create Your JavaScript Files!
&lt;/h3&gt;

&lt;p&gt;This is where the fun part starts, will be playing around with the new syntax! Here’s a very simple code snippet with arrow functions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;((con) =&amp;gt; {
  ['yes', 'no'].forEach((item) =&amp;gt; {
    con.log(item);
  })
})(console);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Cool huh?!&lt;/p&gt;

&lt;p&gt;OK, sample is created, let’s transpile it into “traditional” JavaScript for browsers that don’t yet support ES2015!&lt;/p&gt;

&lt;h3&gt;
  
  
  Transpile the JavaScript
&lt;/h3&gt;

&lt;p&gt;With Babel in place and our JavaScript code ready for treatment, we’ll trigger the process:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./node\_modules/.bin/babel src -d dest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That command transpiles every JavaScript file in the src directory and places it within the dest directory. Our sample JavaScript file becomes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'use strict';

(function (con) {
  ['yes', 'no'].forEach(function (item) {
    con.log(item);
  });
})(console);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There you go….you can now start using ES6!!&lt;/p&gt;

</description>
      <category>es2015</category>
      <category>es6</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Understanding How CSS Calc() Works</title>
      <dc:creator>Chuks Festus</dc:creator>
      <pubDate>Mon, 13 Mar 2017 14:15:15 +0000</pubDate>
      <link>https://dev.to/chuksfestus/understanding-how-css-calc-works-3lb1</link>
      <guid>https://dev.to/chuksfestus/understanding-how-css-calc-works-3lb1</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F620%2F1%2ATwIyl61pW99byVdyxdNwEA.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F620%2F1%2ATwIyl61pW99byVdyxdNwEA.jpeg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The css3 calc() function is a native CSS way to perform simple mathematical operations property values. Being able to do math in code is nice and a welcome addition to a language that is fairly number heavy.&lt;/p&gt;

&lt;p&gt;But is it useful? Well Instead of declaring, for example, static pixel values for an element’s width, we can use calc() to specify that the width be the result of the addition of two or more numeric values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.example {
    width: calc(100px + 50px);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Can’t I Just Use Preprocessors?
&lt;/h3&gt;

&lt;p&gt;All CSS Preprocessors do have math functions and they are pretty useful. If you have used CSS pre-processors like SASS then you must have come across something like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.example\_\_one {
    width: 100px + 50px;
}

// Or using SASS variables
$width-one: 100px;
$width-two: 50px;
.example\_\_two {
    width: $width-one + $width-two;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above example seems pretty cool however, the calc() function provides a better solution for two reasons. First is it’s &lt;strong&gt;ability to mix units.&lt;/strong&gt; We can &lt;strong&gt;combine&lt;/strong&gt; relative units such as percentages with absolute units such as pixels. Preprocessors can’t do that because It is something that has to happen at render time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.foo {
    width: calc(100% - 3em);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the .foo element will always have a width that is 3em less than 100% of it's parent width.&lt;/p&gt;

&lt;p&gt;Second, when doing mathematical expressions with CSS pre-processors, the value given to the browser is the resulting value of the expression.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Value specified in SCSS
.foo {
    width: 150px + 50px;
}

// Compiled CSS and computed value in browser
.foo {
    width: 200px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, with calc() the value parsed by the browser is the actual calc() expression.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Value specified in CSS
.foo {
    width: calc(100% - 50px);
}

// Computed value in browser
.foo {
    width: calc(100% - 50px);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What this means is that the values in the browser can be more dynamic, and adapt as the viewport changes. We can have an element with a height of the viewport minus an absolute value, and it will adapt as the viewport changes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using Calc()
&lt;/h3&gt;

&lt;p&gt;The calc() function has four simple math operators: add (+), subtract (-), multiply (*), and divide (/). Basically the calc() CSS function can be used anywhere a , , ,&lt;time&gt;, , or  is required.&lt;/time&gt;&lt;/p&gt;

&lt;p&gt;The calc() function can also be nested like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.foo {
    width: calc( 100% / calc(25px \* 8) );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Providing Fallbacks
&lt;/h3&gt;

&lt;p&gt;For browsers that don’t support calc(), the entire property-value expression is ignored. This means that we can easily provide a fallback static value that will be used by non-supporting browsers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.thing {   
    width: 90%; /\* fallback if needed \*/   
    width: calc(100% - 3em); 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>webdesign</category>
      <category>webdev</category>
      <category>css</category>
      <category>csspreprocessors</category>
    </item>
    <item>
      <title>Tips to becoming a better developer</title>
      <dc:creator>Chuks Festus</dc:creator>
      <pubDate>Thu, 09 Mar 2017 14:43:45 +0000</pubDate>
      <link>https://dev.to/chuksfestus/tips-to-becoming-a-better-developer-2n0a</link>
      <guid>https://dev.to/chuksfestus/tips-to-becoming-a-better-developer-2n0a</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F900%2F1%2AuOse74deMh527tMfhQ9JfA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F900%2F1%2AuOse74deMh527tMfhQ9JfA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A few months ago i gave a talk at Django girls Minna event, and i keep getting questions like: How did you become such a badass developer? How do i go from being a Genin to becoming a Kage…?&lt;/p&gt;

&lt;p&gt;So this is my attempt to answer those questions. Please not am not a “kage” yet but i think over the years i have learnt a thing or two.&lt;/p&gt;

&lt;h3&gt;
  
  
  Always Plan your projects
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F224%2F1%2AmRqTEt2Qquks7mu5tRhgIw.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F224%2F1%2AmRqTEt2Qquks7mu5tRhgIw.jpeg"&gt;&lt;/a&gt;what’s the plan&lt;/p&gt;

&lt;p&gt;The most common mistake you see developers making is falling to plan, some even think its not their job. The truth is good planing helps save lots of time, reduces stress and comfortably &lt;strong&gt;finish on time everyday.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There are lots of awesome planning tools like &lt;a href="https://trello.com" rel="noopener noreferrer"&gt;trello&lt;/a&gt;( create a project board and cards for each of your templates and elements), &lt;a href="https://www.writemaps.com" rel="noopener noreferrer"&gt;writemaps&lt;/a&gt;, oh and the good old paper and pencil&lt;/p&gt;

&lt;h3&gt;
  
  
  Never stop being curious
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F501%2F1%2AU3fvHOvu9PBnQ8rQrgHGsA.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F501%2F1%2AU3fvHOvu9PBnQ8rQrgHGsA.jpeg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;New tools, plugins, techniques and languages are being released almost everyday, its very important you stay open to all the new things and make an effort to explore and understand them&lt;/p&gt;

&lt;p&gt;The bad and at the same time the beauty of &lt;strong&gt;front-end development&lt;/strong&gt; is that it’s moving forward &lt;strong&gt;very fast&lt;/strong&gt;. This means that you can &lt;strong&gt;quickly become an expert&lt;/strong&gt; but also your skills can &lt;strong&gt;become very quickly outdated&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;You don’t need to know everything, just having a rough overview about a topic or technique is fine. You can then dive deeper into it when the right project comes along.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Invest in your skills
&lt;/h3&gt;

&lt;p&gt;But isn’t that the same as being curious? NO.&lt;/p&gt;

&lt;p&gt;You will need to &lt;strong&gt;invest in yourself in order to grow&lt;/strong&gt;. I don’t mean &lt;strong&gt;spending money&lt;/strong&gt; on expensive courses, seminars or books, I am more thinking about &lt;strong&gt;investing your time&lt;/strong&gt;. There is &lt;strong&gt;no short-cut to success&lt;/strong&gt; and researches show that it takes around &lt;strong&gt;10000 hours to master a skill&lt;/strong&gt; , that’s around &lt;strong&gt;4 years practicing 40 hours a week&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Be prepared&lt;/strong&gt; to put up with late nights exploring other websites, experimenting with a new plugins and frameworks, reading web development blogs, listening to podcasts and chewing through thousands of tweets.&lt;/p&gt;

&lt;h3&gt;
  
  
  Find a mentor
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F279%2F1%2AK77m1FaQ4DJF1fNJ7nHlDw.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F279%2F1%2AK77m1FaQ4DJF1fNJ7nHlDw.jpeg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And i don’t mean someone you just admire and will probably never meet till you die, Find someone with more experience than you, someone who is keen to &lt;strong&gt;help you to grow&lt;/strong&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  A good mentor will help you:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;to &lt;strong&gt;get advice&lt;/strong&gt; on your project approach&lt;/li&gt;
&lt;li&gt;to &lt;strong&gt;get a sense of direction&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;to help you foresee any &lt;strong&gt;potential roadblocks&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Keep it Simple
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F800%2F1%2A5Km684vkhoXop27fgCeD0Q.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F800%2F1%2A5Km684vkhoXop27fgCeD0Q.jpeg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Planning for the unlikely makes code unnecessarily complex. Don’t try to foresee your project’s requirements in two years from now — too many things can (and &lt;strong&gt;will&lt;/strong&gt; ) change! You would waste time on an overly complex solution for a problem that proves to be different than you thought.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Keep in mind:&lt;/strong&gt; Keeping it simple shouldn’t be confused with “quick and dirty”. You still have to work thoroughly and carefully!&lt;/p&gt;

&lt;h3&gt;
  
  
  Unit Testing
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F530%2F1%2AE5RxhO_18-PElvUMcV2rFg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F530%2F1%2AE5RxhO_18-PElvUMcV2rFg.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Every programmer has experienced something like this: you change a bit of code in one corner, and in a (seemingly) unrelated corner, something breaks! The bitter truth is: both new and changed code will inevitably contain bugs. Use automated tests that help you keep old code stable.&lt;/p&gt;

&lt;p&gt;That’s it fellas, let me know what you think or if you think i missed something… keep slaying that code tho mighty developer&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>webdesign</category>
    </item>
    <item>
      <title>The Difference Between Web Designers and Web Developers</title>
      <dc:creator>Chuks Festus</dc:creator>
      <pubDate>Tue, 07 Mar 2017 11:50:32 +0000</pubDate>
      <link>https://dev.to/chuksfestus/the-difference-between-web-designers-and-web-developers-1hmo</link>
      <guid>https://dev.to/chuksfestus/the-difference-between-web-designers-and-web-developers-1hmo</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7mTnM6QG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/750/1%2AkdmetSTsam1B2l3BAdGowQ.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7mTnM6QG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/750/1%2AkdmetSTsam1B2l3BAdGowQ.jpeg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you’ve ever worked in, on, with, or around the Internet, you’ve undoubtedly heard the terms “Web Designer” and “Web Developer”. Oftentimes, the two phrases are used interchangeably by someone who is not familiar with the industry. I mean — designer and developer — they’re the same thing, right? Wrong!!.&lt;/p&gt;

&lt;p&gt;The truth, is that the term reference two fundamentally different aspects of website development and require two different unique skill sets.&lt;/p&gt;

&lt;p&gt;Let’s face it, if you have the word “Web” in your euphemism, you’ve probably been hammered with questions from both sides of the playing field. Designers will hear things like “how can we add a database to the website?”, while developers struggle to answer questions about layout, color selection, image placement, and font styles.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Take a Closer Look at Web Design&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before we continue, one important facet of a web designer is to understand the objective of the client’s website then everything else follows. The best Web Designers are of the &lt;em&gt;creative&lt;/em&gt; type. They have a knack for getting inside of their clients’ heads and realizing their clients’ vision.&lt;/p&gt;

&lt;p&gt;The biggest objective of the designer is to select the right color, layout, font and images which ultimately create the whole personality of the website. Besides the user-friendly web pages a designer works on the usability of the website. Web designers create pages that the target market can relate to.&lt;/p&gt;

&lt;p&gt;For example, if you create a website for nursery children to be designed with the help of large fonts, bright colors, graphics, less text and images. This would make the website attractive and captures the attention of the target audience.&lt;/p&gt;

&lt;p&gt;Hence, their work relies on information flow, graphic design and color scheming and their tools of work include using languages such as HTML, CSS and Javascript.&lt;/p&gt;

&lt;h4&gt;
  
  
  So what about web development…
&lt;/h4&gt;

&lt;p&gt;Web Developers are usually more &lt;em&gt;technical&lt;/em&gt; in nature.&lt;/p&gt;

&lt;p&gt;They use the design created by the design team and work on the back end to create a fully functional website. These are the people behind the smooth functioning of every element on the web page when users interact with the website. They take care of all the behind the scene works of a website.&lt;/p&gt;

&lt;p&gt;Most of these developers will use certain coding languages in creating a website for your use, for example, the use of HTML as the front end designing language while the use of a dynamic and potent server scripting language such as PHP and MySQL for the back end of the website.&lt;/p&gt;

</description>
      <category>design</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
