<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by luiz tanure on Medium]]></title>
        <description><![CDATA[Stories by luiz tanure on Medium]]></description>
        <link>https://medium.com/@tanure?source=rss-3181f7538233------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Z4IZuDBp-AKHwZB2nIos7Q.jpeg</url>
            <title>Stories by luiz tanure on Medium</title>
            <link>https://medium.com/@tanure?source=rss-3181f7538233------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 19:09:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tanure/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Flexible Layouts Made Easy with CSS Flexbox]]></title>
            <link>https://medium.com/@tanure/flexible-layouts-made-easy-with-css-flexbox-f8f47c6ae550?source=rss-3181f7538233------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8f47c6ae550</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[flexbox]]></category>
            <category><![CDATA[layout]]></category>
            <dc:creator><![CDATA[luiz tanure]]></dc:creator>
            <pubDate>Sun, 10 Aug 2025 20:11:56 GMT</pubDate>
            <atom:updated>2025-08-10T20:11:56.462Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>Note:</strong> This article was originally published on October 10, 2015. Some information may be outdated.</blockquote><p>Flexbox (the <strong>Flexible Box Layout Module</strong>) simplifies responsive design.<br> By late 2015 it was supported in all evergreen browsers, replacing many float and table hacks.</p><h4>Core ideas</h4><ul><li>Container and items: set display: flex on a parent, then its children become flex items.</li><li>Main axis vs cross axis: direction depends on flex-direction.</li><li>Space distribution and alignment happen with a small set of properties.</li></ul><h4>Essential container properties</h4><ul><li>display: flex -- activate Flexbox on the parent.</li><li>flex-direction -- row (default) or column layout.</li><li>flex-wrap -- allow items to wrap onto multiple lines.</li><li>justify-content -- align items on the <strong>main axis</strong> (flex-start, center, space-between, etc.).</li><li>align-items -- align items on the <strong>cross axis</strong> (perpendicular to main).</li><li>align-content -- multi‑line cross‑axis spacing (only when wrapping).</li></ul><h4>Essential item properties</h4><ul><li>flex -- shorthand for flex-grow flex-shrink flex-basis.</li><li>flex-basis -- preferred size before free space is distributed.</li><li>align-self -- override align-items for a single item.</li><li>order -- change visual order without changing markup.</li></ul><h4>Pattern 1 — Center anything</h4><pre>.center {<br>  display: flex;<br>  justify-content: center;<br>  align-items: center;<br>  min-height: 100vh;<br>}</pre><pre>&lt;div class=&quot;center&quot;&gt;<br>  &lt;p&gt;Perfectly centred&lt;/p&gt;<br>&lt;/div&gt;</pre><h4>Pattern 2 — Responsive navbar</h4><pre>.nav {<br>  display: flex;<br>  justify-content: space-between;<br>  align-items: center;<br>}<br><br>.nav ul {<br>  display: flex;<br>  gap: 1rem;<br>  list-style: none;<br>  margin: 0;<br>  padding: 0;<br>}</pre><pre>&lt;header class=&quot;nav&quot;&gt;<br>  &lt;h1&gt;Logo&lt;/h1&gt;<br>  &lt;ul&gt;<br>    &lt;li&gt;&lt;a href=&quot;/&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;<br>    &lt;li&gt;&lt;a href=&quot;/blog&quot;&gt;Blog&lt;/a&gt;&lt;/li&gt;<br>    &lt;li&gt;&lt;a href=&quot;/about&quot;&gt;About&lt;/a&gt;&lt;/li&gt;<br>  &lt;/ul&gt;<br>&lt;/header&gt;</pre><p>Items stay in a single row, and spacing adjusts automatically.</p><h4>Pattern 3 — Equal‑height columns</h4><pre>.columns {<br>  display: flex;<br>  gap: 1rem;<br>}<br><br>.columns &gt; article {<br>  flex: 1;        /* all articles share free space equally */<br>  padding: 1rem;<br>  background: #f3f3f3;<br>}</pre><pre>&lt;section class=&quot;columns&quot;&gt;<br>  &lt;article&gt;One&lt;/article&gt;<br>  &lt;article&gt;Two&lt;/article&gt;<br>  &lt;article&gt;Three&lt;/article&gt;<br>&lt;/section&gt;</pre><p>Each column grows to the same height without extra hacks.</p><h4>Pattern 4 — Simple card grid with wrap</h4><pre>.cards {<br>  display: flex;<br>  flex-wrap: wrap;<br>  gap: 1rem;<br>}<br><br>.card {<br>  flex: 1 1 200px; /* grow, shrink, basis */<br>  background: #fff;<br>  border: 1px solid #ccc;<br>}</pre><pre>&lt;div class=&quot;cards&quot;&gt;<br>  &lt;div class=&quot;card&quot;&gt;Card 1&lt;/div&gt;<br>  &lt;div class=&quot;card&quot;&gt;Card 2&lt;/div&gt;<br>  &lt;div class=&quot;card&quot;&gt;Card 3&lt;/div&gt;<br>  &lt;div class=&quot;card&quot;&gt;Card 4&lt;/div&gt;<br>&lt;/div&gt;</pre><p>Cards wrap automatically as the viewport shrinks.</p><h4>Browser support</h4><ul><li>Chrome, Firefox, Safari, Edge (Chromium) support the final syntax.</li><li>Older IE 10/11 versions use an outdated spec with vendor prefixes; check before dropping floats completely.</li></ul><h4>Further reading</h4><ul><li>CSS Tricks <strong>“A Guide to Flexbox”</strong> — complete reference with visuals.</li><li>MDN <strong>flexbox</strong> docs — property‑by‑property explanations.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8f47c6ae550" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flexible Layouts Made Easy with CSS Flexbox]]></title>
            <link>https://medium.com/@tanure/flexible-layouts-made-easy-with-css-flexbox-212b0d5f6591?source=rss-3181f7538233------2</link>
            <guid isPermaLink="false">https://medium.com/p/212b0d5f6591</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[layout]]></category>
            <category><![CDATA[flexbox]]></category>
            <category><![CDATA[responsive]]></category>
            <dc:creator><![CDATA[luiz tanure]]></dc:creator>
            <pubDate>Sun, 10 Aug 2025 20:10:55 GMT</pubDate>
            <atom:updated>2025-08-10T20:10:55.525Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>Note:</strong> This article was originally published on October 10, 2015. Some information may be outdated.</blockquote><p>Flexbox gives you a one‑dimensional layout system that aligns, distributes, and reorders items with just a few lines of CSS.<br> By late 2015 most evergreen browsers shipped full Flexbox support, replacing many float or table hacks.</p><h4>Core ideas</h4><ul><li>A <strong>flex container</strong> establishes a new layout context using display: flex or inline-flex.</li><li>Items inside can grow, shrink, and wrap automatically along the <strong>main axis</strong>.</li><li>Alignment happens along two axes with justify-content and align-items.</li><li>The order of items is independent of source order via the order property.</li></ul><h4>Common patterns</h4><h4>1. Perfect centering</h4><pre>.centered {<br>  display: flex;<br>  justify-content: center; /* horizontal */<br>  align-items: center;     /* vertical   */<br>  min-height: 100vh;<br>}</pre><pre>&lt;div class=&quot;centered&quot;&gt;<br>  &lt;p&gt;Centered with Flexbox&lt;/p&gt;<br>&lt;/div&gt;</pre><h4>2. Responsive navbar</h4><pre>.navbar {<br>  display: flex;<br>  justify-content: space-between;<br>  align-items: center;<br>  padding: 0.5rem 1rem;<br>}<br><br>.navbar ul {<br>  display: flex;<br>  gap: 1rem;<br>  list-style: none;<br>  margin: 0;<br>  padding: 0;<br>}<br><br>@media (max-width: 600px) {<br>  .navbar ul {<br>    flex-direction: column;<br>    align-items: flex-start;<br>  }<br>}</pre><pre>&lt;header class=&quot;navbar&quot;&gt;<br>  &lt;strong&gt;Logo&lt;/strong&gt;<br>  &lt;ul&gt;<br>    &lt;li&gt;&lt;a href=&quot;/&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;<br>    &lt;li&gt;&lt;a href=&quot;/&quot;&gt;Docs&lt;/a&gt;&lt;/li&gt;<br>    &lt;li&gt;&lt;a href=&quot;/&quot;&gt;About&lt;/a&gt;&lt;/li&gt;<br>  &lt;/ul&gt;<br>&lt;/header&gt;</pre><p>The menu shifts from a row to a stacked column on narrow screens without extra markup.</p><h4>3. Simple equal‑height columns</h4><pre>.columns {<br>  display: flex;<br>  gap: 1rem;<br>}<br><br>.columns &gt; article {<br>  flex: 1;              /* same width */<br>  background: #fafafa;<br>  padding: 1rem;<br>}</pre><pre>&lt;section class=&quot;columns&quot;&gt;<br>  &lt;article&gt;Left&lt;/article&gt;<br>  &lt;article&gt;Center&lt;/article&gt;<br>  &lt;article&gt;Right&lt;/article&gt;<br>&lt;/section&gt;</pre><p>Each column stretches to the same height because flex items default to align-stretch.</p><h4>4. Auto‑wrapping card grid</h4><pre>.grid {<br>  display: flex;<br>  flex-wrap: wrap;<br>  gap: 1rem;<br>}<br><br>.card {<br>  flex: 1 1 200px; /* grow, shrink, base width */<br>  background: #fff;<br>  border: 1px solid #ddd;<br>  padding: 1rem;<br>}</pre><pre>&lt;div class=&quot;grid&quot;&gt;<br>  &lt;div class=&quot;card&quot;&gt;Card&lt;/div&gt;<br>  &lt;div class=&quot;card&quot;&gt;Card&lt;/div&gt;<br>  &lt;div class=&quot;card&quot;&gt;Card&lt;/div&gt;<br>  &lt;!-- more cards --&gt;<br>&lt;/div&gt;</pre><p>flex-wrap: wrap lets items flow to a new line once they hit the minimum 200px size, ideal for gallery or dashboard layouts.</p><h4>Tips</h4><ul><li>Use gap to add consistent spacing between items; fallback with margins for very old browsers.</li><li>Keep flex: 1 shorthand as flex: grow shrink basis (auto for basis by default).</li><li>Provide a graceful fallback (display: block) for IE9 and below.</li><li>For complex grids, combine Flexbox with media queries or move to CSS Grid once support is stable.</li></ul><p>Flexbox removes many layout headaches, bringing concise, predictable rules to everyday UI patterns.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=212b0d5f6591" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Module Bundling 101 with Webpack]]></title>
            <link>https://medium.com/@tanure/module-bundling-101-with-webpack-66d6a4203d77?source=rss-3181f7538233------2</link>
            <guid isPermaLink="false">https://medium.com/p/66d6a4203d77</guid>
            <category><![CDATA[tooling]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[webpack]]></category>
            <dc:creator><![CDATA[luiz tanure]]></dc:creator>
            <pubDate>Sun, 10 Aug 2025 20:09:54 GMT</pubDate>
            <atom:updated>2025-08-10T20:09:54.604Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>Note:</strong> This article was originally published on August 18, 2015. Some information may be outdated.</blockquote><p>Webpack is a <strong>module bundler</strong> that crawls your dependency graph, applies transforms, and emits one or more bundles ready for the browser. <a href="https://medium.com/">Docs</a></p><h4>Why bundle?</h4><ul><li>Resolve import / require() at build‑time so browsers get plain scripts.</li><li>Combine many files into fewer HTTP requests which speeds up first load.</li><li>Transform code with <strong>loaders</strong> (e.g. Babel turns ES6 → ES5, Sass → CSS, images → base64).</li><li>Optimise output with minification, dead‑code elimination, and code‑splitting.</li><li>Enable live editing with <strong>Hot Module Replacement (HMR)</strong> — update modules in‑place without a full refresh.</li></ul><h4>Key terms</h4><p>| Term | Purpose | | — — — — — -| — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — | | Entry | Starting file for building the dependency graph | | Output | Where Webpack writes the final bundle files | | Loader | Function that transforms matched file types during the build | | Plugin | Hook that extends Webpack (minification, env vars, etc.) | | Dev Server| Memory‑only server that serves bundles and supports HMR | | HMR | Runtime patching of changed modules without page reload |</p><h4>Project structure</h4><pre>my-app/<br>├─ src/<br>│  ├─ index.js<br>│  └─ message.js<br>├─ dist/<br>└─ webpack.config.js</pre><h4>Install Webpack 1 and Babel</h4><pre># Initialise package.json<br>npm init -y<br><br># Core bundler and dev server<br>npm install --save-dev webpack@1 webpack-dev-server@1<br><br># Transpile ES6 to ES5<br>npm install --save-dev babel-core babel-loader babel-preset-es2015</pre><p>Create a <strong>.babelrc</strong>:</p><pre>{<br>  &quot;presets&quot;: [&quot;es2015&quot;]<br>}</pre><h4>webpack.config.js</h4><pre>const path = require(&#39;path&#39;);<br><br>module.exports = {<br>  entry: &#39;./src/index.js&#39;,<br><br>  output: {<br>    path: path.join(__dirname, &#39;dist&#39;),<br>    filename: &#39;bundle.js&#39;<br>  },<br><br>  module: {<br>    loaders: [<br>      {<br>        test: /\.js$/,<br>        loader: &#39;babel&#39;,<br>        exclude: /node_modules/<br>      }<br>    ]<br>  },<br><br>  devServer: {<br>    static: &#39;dist&#39;,<br>    inline: true,<br>    hot: true<br>  }<br>};</pre><h4>Demo code</h4><p><strong>src/index.js</strong></p><pre>import message from &#39;./message&#39;;<br><br>document.body.innerHTML = `&lt;h1&gt;${message}&lt;/h1&gt;`;</pre><p><strong>src/message.js</strong></p><pre>export default &#39;Hello, Webpack!&#39;;</pre><h4>Build and run</h4><pre># Production bundle<br>webpack --mode production<br><br># Development server with hot‑reload<br>webpack-dev-server --hot --open</pre><p>Open the local URL printed in the terminal, edit src/message.js, and watch HMR update the page instantly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66d6a4203d77" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Writing Future‑Proof Code with Babel]]></title>
            <link>https://medium.com/@tanure/writing-future-proof-code-with-babel-210a0957de8b?source=rss-3181f7538233------2</link>
            <guid isPermaLink="false">https://medium.com/p/210a0957de8b</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[babel]]></category>
            <category><![CDATA[tooling]]></category>
            <dc:creator><![CDATA[luiz tanure]]></dc:creator>
            <pubDate>Fri, 18 Jul 2025 18:16:47 GMT</pubDate>
            <atom:updated>2025-07-18T18:16:47.044Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>Note:</strong> This article was originally published on June 12, 2015. Some information may be outdated.</blockquote><p>Babel is a JavaScript compiler.<br> It converts modern syntax into code that older browsers understand.<br> In 2015 this made it possible to use ES6 features in production while IE‑only engines were still common.</p><h4>Why Babel matters</h4><ul><li><strong>Early access</strong> — arrow functions, classes, modules, and more without waiting for native support</li><li><strong>Config file</strong> — .babelrc keeps presets and plugins in one place</li><li><strong>Plugin system</strong> — choose only the transforms you need</li><li><strong>Multiple outputs</strong> — turn ES modules into CommonJS, AMD, or System formats</li></ul><h4>Project setup</h4><pre># Install CLI and the ES2015 preset locally<br>npm install --save-dev babel-cli babel-core babel-preset-es2015<br><br># Optional: watcher for automatic rebuilds<br>npm install --save-dev babel-watch</pre><p>Create <strong>.babelrc</strong>:</p><pre>{<br>  &quot;presets&quot;: [&quot;es2015&quot;]<br>}</pre><h4>Example: Transpile a small module</h4><p><strong>src/math.js</strong></p><pre>export const PI = 3.14;<br>export const double = n =&gt; n * 2;</pre><p>Build the file:</p><pre># One‑off build<br>npx babel src --out-dir lib<br><br># Continuous build during development<br>npx babel-watch src --out-dir lib</pre><p><strong>lib/math.js</strong> (output)</p><pre>&#39;use strict&#39;;<br><br>Object.defineProperty(exports, &quot;__esModule&quot;, {<br>  value: true<br>});<br>var PI = exports.PI = 3.14;<br>var double = exports.double = function double(n) {<br>  return n * 2;<br>};</pre><p>The ES6 export statements become CommonJS assignments, ready for Node or older browsers after bundling.</p><h4>Common build integrations</h4><ul><li><strong>Browserify</strong> — add babelify as a transform</li><li><strong>Grunt / Gulp</strong> — run grunt-babel or gulp-babel in the task pipeline</li></ul><h4>Key ES6 features you can ship today</h4><ul><li>let and const block‑scoped variables</li><li>Arrow functions with lexical this</li><li>Classes with concise method syntax</li><li>Template literals with ${} interpolation</li><li>Destructuring for arrays and objects</li></ul><p>Each transform is handled by the preset, so the workflow stays simple after the initial install.</p><p>Babel removes the waiting game.<br> Write modern JavaScript, compile once, and run everywhere.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=210a0957de8b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building UIs with React.js — A Beginner’s Tutorial]]></title>
            <link>https://medium.com/@tanure/building-uis-with-react-js-a-beginners-tutorial-033043c987e1?source=rss-3181f7538233------2</link>
            <guid isPermaLink="false">https://medium.com/p/033043c987e1</guid>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[luiz tanure]]></dc:creator>
            <pubDate>Fri, 18 Jul 2025 18:15:46 GMT</pubDate>
            <atom:updated>2025-07-18T18:15:46.196Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>Note:</strong> This article was originally published on March 20, 2015. Some information may be outdated.</blockquote><p>React is a library for creating user interfaces with a <strong>component‑based</strong> approach and a <strong>virtual DOM</strong> diffing engine.</p><p>React 0.13 (released March 2015) added optional ES6 class support but React.createClass remains the common style.</p><h4>Why React changes front‑end work</h4><ul><li><strong>Component isolation</strong> — each piece of UI is a self‑contained function of props and state.</li><li><strong>Virtual DOM</strong> — React builds an in‑memory tree and updates only the changed parts on the real DOM, avoiding full page reflows.</li><li><strong>One‑way data flow</strong> — parent → child props keep data reasoning straight.</li><li><strong>Declarative rendering</strong> — describe <em>what</em> the UI looks like; React figures out <em>how</em> to update it.</li></ul><p><em>(Check the React v0.13 release notes for details on class support and goals.)</em></p><h4>Quick setup</h4><p>Add React, ReactDOM, and JSX transformer via CDN:</p><pre>&lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react.js&quot;&gt;&lt;/script&gt;<br>&lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react-dom.js&quot;&gt;&lt;/script&gt;<br>&lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js&quot;&gt;&lt;/script&gt;<br>&lt;div id=&quot;app&quot;&gt;&lt;/div&gt;</pre><p>Write components in a &lt;script type=&quot;text/babel&quot;&gt; block.<br> The browser runs Babel in‑place to transform JSX into plain JavaScript.</p><h4>Component list</h4><ul><li><a href="#counter-component">Counter component</a></li><li><a href="#app-wrapper">App wrapper</a></li><li><a href="#rendering">Rendering</a></li></ul><h4>Counter component</h4><p>Uses React.createClass and local state.</p><pre>const Counter = React.createClass({<br>  getInitialState() {<br>    return { count: 0 };<br>  },<br>  add() {<br>    this.setState({ count: this.state.count + 1 });<br>  },<br>  render() {<br>    return (<br>      &lt;button onClick={this.add}&gt;<br>        Clicked {this.state.count} times<br>      &lt;/button&gt;<br>    );<br>  }<br>});</pre><h4>App wrapper</h4><p>Holds the Counter and shows a heading.</p><pre>const App = React.createClass({<br>  render() {<br>    return (<br>      &lt;section&gt;<br>        &lt;h1&gt;Demo: React Counter&lt;/h1&gt;<br>        &lt;Counter /&gt;<br>      &lt;/section&gt;<br>    );<br>  }<br>});</pre><h4>Rendering</h4><pre>ReactDOM.render(&lt;App /&gt;, document.getElementById(&#39;app&#39;));</pre><p>React builds a virtual DOM tree from App, compares it with the previous tree on every setState, and patches only the node that displays the count.</p><h4>JSX syntax</h4><p>JSX lets you write HTML‑like tags in JavaScript. Babel turns this syntax into React.createElement calls.</p><pre>const element = &lt;h1 className=&quot;title&quot;&gt;Hello React&lt;/h1&gt;;</pre><p>The code above compiles to:</p><pre>const element = React.createElement(<br>  &#39;h1&#39;,<br>  { className: &#39;title&#39; },<br>  &#39;Hello React&#39;<br>);</pre><h4>Props versus state</h4><ul><li><strong>Props</strong>: read‑only data passed from parent to child.</li><li><strong>State</strong>: mutable data local to a component.</li></ul><p>State changes with setState() cause React to re‑render the component and its children. Props flow down; state stays inside.</p><h4>Key takeaways</h4><ul><li>Components bundle markup, logic, and state.</li><li>State changes trigger efficient re‑renders through the virtual DOM diff.</li><li>Composition lets small pieces form complex UIs.</li></ul><p>This counter shows the minimum needed to start. Expand with more components, props, and events to grow a full application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=033043c987e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring ECMAScript 2015 (ES6) Features]]></title>
            <link>https://medium.com/@tanure/exploring-ecmascript-2015-es6-features-4d61f3155232?source=rss-3181f7538233------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d61f3155232</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[es6]]></category>
            <dc:creator><![CDATA[luiz tanure]]></dc:creator>
            <pubDate>Fri, 18 Jul 2025 18:14:45 GMT</pubDate>
            <atom:updated>2025-07-18T18:14:45.123Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>Note:</strong> This article was originally published on January 15, 2015. Some information may be outdated.</blockquote><p>ECMAScript 2015 (ES6) adds modern syntax, safer defaults, and built‑in tools for async and modular code.</p><p>Transpile with <strong>Babel</strong>:</p><pre>npm init -y<br>npm install --save-dev @babel/core @babel/cli @babel/preset-env<br>echo &#39;{ &quot;presets&quot;: [&quot;@babel/preset-env&quot;] }&#39; &gt; .babelrc<br>npx babel src --out-dir dist</pre><p>Place ES6 files in <strong>src/</strong>, run the command, and load the output from <strong>dist/</strong> in older browsers.</p><h4>Feature list</h4><ul><li><a href="#let-and-const">let and const</a></li><li><a href="#arrow-functions">Arrow functions</a></li><li><a href="#template-literals">Template literals</a></li><li><a href="#destructuring">Destructuring</a></li><li><a href="#default-rest-spread">Default, rest, spread</a></li><li><a href="#enhanced-object-literals">Enhanced object literals</a></li><li><a href="#classes">Classes</a></li><li><a href="#modules">Modules</a></li><li><a href="#promises">Promises</a></li><li><a href="#iterators-and-forof">Iterators and for..of</a></li><li><a href="#generators">Generators</a></li><li><a href="#map-set-weakmap-weakset">Map, Set, WeakMap, WeakSet</a></li><li><a href="#symbols">Symbols</a></li><li><a href="#unicode--binaryoctal">Unicode &amp; binary/octal</a></li><li><a href="#new-apis">New APIs</a></li><li><a href="#proxies">Proxies</a></li><li><a href="#reflect-api">Reflect API</a></li><li><a href="#tail-call-optimisation">Tail‑call optimisation</a></li></ul><h4>let and const</h4><pre>for (let i = 0; i &lt; 3; i++) {<br>  // i scoped to loop only<br>}<br>const API_URL = &#39;/api&#39;;</pre><h4>Arrow functions</h4><pre>const doubled = [1, 2, 3].map(n =&gt; n * 2);<br>button.addEventListener(&#39;click&#39;, () =&gt; this.save());</pre><h4>Template literals</h4><pre>const user = &#39;Luiz&#39;;<br>const msg = `Hi, ${user}<br>Welcome to ES6.`;</pre><h4>Destructuring</h4><pre>const [red, green] = [&#39;#f00&#39;, &#39;#0f0&#39;];<br><br>const user = { id: 7, role: &#39;admin&#39; };<br>const { id, role } = user;</pre><h4>Default, rest, spread</h4><pre>function greet(name = &#39;guest&#39;) { return `Hi ${name}`; }<br><br>const nums = [1, 2, 3];<br>sum(...nums); // spread into args<br><br>function logAll(...args) { console.log(args); }</pre><h4>Enhanced object literals</h4><pre>const name = &#39;x&#39;;<br>const obj = {<br>  name,                // shorthand<br>  [`prop_${name}`]: 1, // computed key<br>  toString() { return this.name; }<br>};</pre><h4>Classes</h4><pre>class Counter {<br>  constructor(start = 0) { this.count = start; }<br>  inc() { return ++this.count; }<br>}</pre><h4>Modules</h4><pre>// math.js<br>export const PI = 3.14;<br><br>// app.js<br>import { PI } from &#39;./math.js&#39;;<br>console.log(PI);</pre><p><em>Run through Babel or a bundler to use modules in the browser.</em></p><h4>Promises</h4><pre>fetch(&#39;/data.json&#39;)<br>  .then(r =&gt; r.json())<br>  .then(show)<br>  .catch(console.error);</pre><h4>Iterators and for..of</h4><pre>for (const n of [10, 20, 30]) {<br>  console.log(n);<br>}</pre><h4>Generators</h4><pre>function* idMaker() {<br>  let id = 0;<br>  while (true) yield id++;<br>}<br>const gen = idMaker();<br>gen.next().value; // 0</pre><h4>Map, Set, WeakMap, WeakSet</h4><pre>const ids = new Set([1, 2, 2, 3]); // {1,2,3}<br>const dict = new Map([[&#39;key&#39;, 42]]);</pre><h4>Symbols</h4><pre>const secret = Symbol(&#39;secret&#39;);<br>const obj = { [secret]: 123 };</pre><h4>Unicode &amp; binary/octal</h4><pre>&#39;𝌆&#39;.length; // 2 in ES5, fixed helpers in ES6<br><br>0b1010; // 10<br>0o755;  // 493</pre><h4>New APIs</h4><pre>Number.isNaN(NaN);      // true<br>[1, 2, 3].includes(2);  // true<br>Math.trunc(4.8);        // 4<br>Object.assign({}, { a: 1 });</pre><h4>Proxies</h4><pre>const monitor = new Proxy({}, {<br>  get(target, prop) {<br>    console.log(&#39;read&#39;, prop);<br>    return target[prop];<br>  }<br>});<br>monitor.x = 5;<br>monitor.x; // logs &quot;read x&quot;</pre><h4>Reflect API</h4><pre>const obj = {};<br>Reflect.set(obj, &#39;x&#39;, 1);<br>Reflect.get(obj, &#39;x&#39;); // 1</pre><h4>Tail‑call optimisation</h4><pre>function factorial(n, acc = 1) {<br>  return n === 0 ? acc : factorial(n - 1, n * acc);<br>}</pre><p>Tail‑recursive functions can run without growing the call stack in compliant engines.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d61f3155232" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>