Skip to content

Instantly share code, notes, and snippets.

@deborahleehamel
Forked from anonymous/es6-research.markdown
Last active October 11, 2016 01:17
Show Gist options
  • Save deborahleehamel/98975ba55238dde12bc38343d1057c15 to your computer and use it in GitHub Desktop.
Save deborahleehamel/98975ba55238dde12bc38343d1057c15 to your computer and use it in GitHub Desktop.
Length Points Week
15 minutes 5 Week 1

ES6 Research

Throughout the module (and your journey to Google enlightenment while working on IdeaBox2.0) you may notice a few different ways that JavaScript code is being written.

That might have something to do with something called ES6 and ES5

Deliverable

  • Fork This Gist

  • Respond in your forked gist with answers to the following questions

    • What is ES6?

      • ECMAScript 6, ES6, is the sixth major release of the ECMAScript language specification. ECMAScript is the “proper” name for the language commonly referred to as JavaScript.
    • What is Transpilation and how does it relate to ES6?

      • transpilation refers to translations of one language to another;
      • The end goal of andvanced transpilation configurations like Gulp and Babel, is to ship native ES6 to environments capable of running it, and transpiled ES5 everywhere else.
      • With more and more environments supporting ES6 in full (minus modules) it should in theory be possible to transpile only the experimental or non-standard ES features you’re using, and then ship actual ES6 to your users on modern browsers. Of course you’ll also want to run a pre-release process which transpiles everything to ES5 bundles for older engines like Internet Explorer. Lastly, when your app loads, you’ll need client-side JavaScript to detect whether the browser your user is on is ES6 compatible, in order to load either the ES6, or ES5 bundles. The advantages of doing this include debugging against simpler code, and shipping smaller code to users.`
    • Looking at the ES6 Features link below, discuss one update from ES5 and if it seems useful/superfluous

      • Default Parameters:
      • Previously in ES5 we had to us the or (||) statement to define default parameters. var link = function (height, color) { var height = height || 50 var color = color || 'red'}
      • They were okay until the value was 0 and because 0 is falsy in JavaScript it would default to the hard-coded value instead of becoming the value itself. We can put the default values right in the signature of the functions in ES6.This is more like Ruby does it. var link = function(height = 50, color = 'red') {}
  • You can use the resources below or your own Google-fu

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment