|CoffeeScript Gets Regrind|
|Written by Kay Ewbank|
|Monday, 10 February 2014|
CoffeeScript 1.7 has been released with new features requested by developers.
CoffeeScript is described as stable and mostly finished, but this new release does add some new features. In a post on Github about the new version, its creator Jeremy Ashkenas describes the changes (in his own "order of excitement"), starting with support for chaining without parentheses. Until now, you had to use a parenthesis if you wanted to chain functions, as shown in the following example:
This can now be written as:
The new release has also added better support for multiline strings, with the ability to wrap long strings such as user-facing messages without breaking your code's indentation, or manually stripping newlines out.
Another improvement is support for expansion for array destructuring. This was the longest open issue on CoffeScript. Until now, if you wanted to get the first and last elements of an array, you’d have to use:
The new version lets you just use
Likewise, if you want to get the last element in an array in the current version, you’d use:
The new version lets you use:
New mathematical operators have been added in the form of a Power operator (**), floor division operator (//), and a modulo operator that respects negatives (%% ).
The 1.7 release is available on the CoffeeScript site and on Github.
To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, Facebook, Google+ or Linkedin, or sign up for our weekly newsletter.
or email your comment to: firstname.lastname@example.org
|Last Updated ( Monday, 10 February 2014 )|