References and Appendix
Appendix A. Setting Up Your Developing Environment For ES6
The best way to get started with ES6 is by using an interactive online REPL. Here is a list of some of my favorites:
- Babel REPL - bit.ly/babel-repl. Babel is a ES6 transpiler that let’s you take advantage of ES6 and ESnext features today. It is the de facto ES6 transpiler.
- jsBin - jsbin.com. JsBin is a very popular web prototyping tool with a customizable set of pans to visualize HTML, CSS, JavaScript, a console and the output.
- jsFiddle - jsfiddle.net. JsFiddle is yet another popular prototyping tool that let’s you look at your HTML, CSS, JavaScript and output at a glance.
- CodePen - codepen.io is a web prototyping tool and community.
- ES6 Katas - es6katas.org is a collection of interactive katas to learn ES6.
Using ES6 with Node.js
In addition to using prototyping tools for the web, node.js has great support for ES6 as you can appreciate in these compatibility table. But it you want to be able to use all features of ES6 and ESnext you can take advatange of babel.js and the babel-node REPL.
You can install it using the following command:
1 $ npm install -g babel
And start it using babel node:
1 $ babel-node
This will open a REPL that has complete support for ES6.
ES6 and Modern Browsers
Modern browsers also have an increasing support for ES6. The ES6 compability table can give you a general idea as to how the efforts from the different vendors are going.
The problem with developing for the browser is that you cannot control the runtime in which your application is running like you do when developing a backend in node.js. This means that you cannot rely on your user’s browser having the features that you need or want to use. Because of that, transpiling your application from ES6 to ES5 becomes crucial in these environments to make sure that it works in a myriad of devices and can reach as many users as possible.
There’s a wide variety of tools that let you transpile your ES6 code to something that can work on any browser and setup a real world ES6 development environment.
Real-World ES6 Development Environments
The de facto standard for transpiling ES6 is babel.js. It is very extensible and can be plugged into any of the modern front-end build pipelines. It uses a plugin system that lets you easily decide which features of ES6 and ESnext you want to enable.
Depending on your build tooling of choice you’ll need to follow different steps to start using Babel. You can find numerous and extensive guides for Gulp, WebPack, Grunt, Broccoli, etc at bit.ly/setup-es6.
Appendix B. Fantasy Glossary
If you are not familiar with the genre of fantasy you may have a hard time understanding some of the words I use in this book. Hopefully this glossary will give you some guidance in this respect.
- Arcane: Something that is mysterious or secret. Known or understood by very few people.
- Alchemy: A science that was used in the Middle Ages with the goal of changing ordinary metals into gold. Also a power or process that changes or transforms something in a mysterious or impressive way.
- Cimmerian barbarian: Barbarian from the extreme confines of Cimmeria.
- Conan: “Hither came Conan, the Cimmerian, black-haired, sullen-eyed, sword in hand, a thief, a reaver, a slayer, with gigantic melancholies and gigantic mirth, to tread the jeweled thrones of the Earth under his sandalled feet.”
- Balefire: Balefire is a weapon of the One Power. When a target is struck with balefire, its thread in the Pattern is destroyed, in an amount proportional to the power of the balefire strike. This translates to both the target’s existence, and actions up to a certain point, being retroactively erased.
- Gandalf: Mighty wizard that has the magic ability to always be on time.
- Goblin: An ugly and sometimes evil creature that likes to cause trouble.
- Golem: An artificial creature being endowed with life by magic. It is often associated to different elements and materials: fire, earth, sand, etc.
- Hobbit: Hobbits are similar to humans, but about half their size. They’re chubby, furry-footed home-bodies with a penchant for dwelling in hollowed out hillsides and a racial talent for burglary.
- Halfling: see Hobbit.
- JavaScript-mancer: Person that has mastered the art of writing awesome JavaScript and has an intimate knowledge of it.
- JavaScript-mancy: The arcane art of using JavaScript to alter the world around you.
- Kender: A race of wizened 14-year-olds that, unlike halflings, wear shoes.
- Mana: For those of you not familiar with magic, mana can be seen as a measure of magical stamina. As such, doing magic (like summoning minions) spends one’s mana. An empty reservoir of mana means no spellcasting just as a empty reserve of stamina means no more running.
- Minion: Someone who is not powerful or important and who obeys the orders of a powerful leader or boss.
- Saruman: Powerful wizard prone who likes white clothing and prone to evil deeds
- Scepter: A staff or baton borne by a sovereign as an emblem of authority. It can be imbued in magic powers.
- Spell: A spoken word or form of words held to have magic power.
- Spellcasting (casting): Performing magic by reciting a spell.
- Summon: To bid a creature to come to your aid with the help of magic. It can also create a creature from nothingness.
- Troll: An evil giant creature than inhabitates caves, hills and bridges. Some of them show weakness to sunlight.
- Teleport: Transfer ones location by using magic
- Orc: A race of human-like creatures, characterized as ugly, warlike, and malevolent.
- Orb: A circular object that possess unbound magic power.
- Wand: A long, thin stick used by a magician to channel its powers.
- Weave: See spellcasting.
References
There’s a lot of books that have inspired me while writing JavaScript-mancy. Here is a non exhaustive list of the most influential.
Specifications
Books
- JavaScript Allonge - Reginald Braithwaite
- You don’t know JS - Kyle Simpson
- Functional JavaScript - Michael Fogus
- Effective JavaScript - David Herman
- Understanding ECMAScript 6 - Nicholas C. Zackas
- Secrets of the JavaScript Ninja - John Resig, Bear Bibeault
- Programming JavaScript Applications - Eric Elliott
- Principles of Object Oriented JavaScript - Nicholas C. Zackas
- Eloquent JavaScript - Adam Freeman
- JavaScript the Good Parts - Douglas Crockford