ECMAScript 6 tutorial shows similarities to python

published Sep 09, 2015 11:09   by admin ( last modified Sep 09, 2015 11:09 )

Use ECMAScript 6 Today - Tuts+ Code Article is a tutorial that is readable, about ECMAScript (Javascript) 6. It is from 2013 so more features may be available directly in the browsers and in Node.js as of today.

As a python developer, the things that stand out as similar to python in ECMAScript 6 are:

  • for x of - Seems to do what pythons for x in does. Javascript has for x in since long but it returns more primitive things.
  • Maps - allows any object and not only strings to be the key, as in python dictionaries.
  • rest and spread - Seems to be like splat (star) in python, that is * although python also has ** for dictionaries (a.ka. maps in ECMAScript 6) which ECMAScript 6 does not have,
  • Default function parameters -seems to work as in python
  • Destructuring - Works as in python, but better. In python you can only return tuples, but in ECMAScript 6 you can also unpack things from objects
  • Array comprehensions - Just like list comprehensions in python, but using of instead of in syntax-wise as noted above.


 

In this article, we'll explore ten new features, with a significant focus on tools, browsers and transpilers.


Read more: Link - Use ECMAScript 6 Today - Tuts+ Code Article