Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Welcome to JavaScript

Sameer Chitley edited this page Jun 6, 2016 · 3 revisions

In Nuclide, we leverage a number of transpilers so we can develop in a futuristic version of JavaScript.

Frequently Misunderstood JavaScript Concepts

If you assume that JavaScript works like your favorite programming language, then you are probably mistaken. Read this.

Promises

We make heavy use of the ES6 Promise class in Nuclide. Read this tutorial and then read it again. The Promise API is not very large, so you should be able to master it quickly.

Also be sure to read this article by the same author on Tasks, microtasks, queues and schedules.

ES6

http://es6-features.org/ is a great place to get a concise summary of the new ES6 features with comparisons to their ES5 equivalents.

Nicholas Zakas is arguably the best JavaScript author out there. He is in the process of drafting a book on ES6, which is available for free online. It's incomplete, but the content that is there is pretty solid, and it's much more readable than the spec.

ES6 + React

We should be following the patterns described here instead of using React.createClass(). See the nuclide/react/ page for general guidelines and examples.

Transpilation

The easiest way to see what your Babel code will transpile to is to use the playground.

Note that this also runs your code, so you can include console.log() statements, whose output will show up in the lower-right-hand corner. Also, the URL updates with the contents of the code on the left, making it easy to share code snippets with others.

Deciphering CoffeeScript

Atom still uses CoffeeScript. If you want to see what the resulting JavaScript will be from CoffeeScript source, the most common way to figure it out is to go to http://coffeescript.org/, click Try CoffeeScript, and paste some CoffeeScript code into the buffer on the left.

However, if you install the Preview package for Atom, you can do all of this without leaving your editor. This is particularly useful when you have Atom's source code open in Atom. Finally, unlike coffeescript.org, it supports multiple languages, including LESS and JSX.