Important Bits

Javascript in 2015 video

January 31, 2015

This demo introduces lots of ES6 features while actually building something. I like it!


ES6 Modules, jspm, and System.js will take deeper dives to understand, but I liked the fat arrow functions and string templating.

In ES6, fat arrow functions and string templating let us write this:

elem.innerHTML = => `<img src="${url}" alt="" />`).join("\n")

Babel says the ES5 version looks like this:

elem.innerHTML = (url) {
  return "<img src=\"" + url + "\" alt=\"\" />";

less code = less syntax errors. I like this!

Fat arrow functions have some funny little bits.

  • ( and ) around arguments are only needed if there is more than 1 argument

  • { and } around the function are only needed around the function body if is more than a line long

But these rules feel funny to me. JS linters have long suggested always including the {, }, and ; even in places where aren’t needed to prevent stupid errors and keep things consistent.

export default posts => {
return posts
.filter(post => !
.slice(0, 5)
.map(post =>
.filter(url => /gifv?$/.exec(url))
.map(url => url.replace(/v$/, ''))

return new Promise((resolve, reject) => {
    jsonp(this.url, {
        param: 'jsonp'
    }, (err, data) => {
        err ? reject(err) : resolve(;

Fat Arrow Functions are also automatically bound to the scope of the object they are enclosed in which makes life simpler when mixing up functional and object oriented programming. Fat Arrow Functions) on MDN has more details.

Adam Sullovey

Written by Adam Sullovey, powered by Gatsby.
Find me on codepen, github, or at Toronto meetups.

tags: javascript