## Org Mode ES2015+ Code Blocks (updated)

Babel 6x is a significant change from Babel 5x, as the cli is now a separate node module called babel-cli and transforms are now also delivered as separate packages. First make a few changes to the emacs environment so you can use JavaScript in org mode, as well as find local node.js modules you have installed. Replace ~/org/node_modules in the configuration below with the location of any local node modules you want to use. Using this approach you don't have to pollute the global node_module directory if you don't want to.

#+begin_src js :cmd "org-babel-node" :results output drawer
let arr = [1, 2];
let [x, y] = arr;

console.log(x);
console.log(y);
#+end_src

:RESULTS:
1
2
:END: