ECMAScript 6 has been around for a while now and whilst browser support is incomplete, it is becoming more ubiquitous across the web.

So, can you make use of some of the newest JavaScript features and syntax in your APEX applications?

Of course! Browser compatibility depending.

Let's look at how an ES5 apex.server.process call could be changed to use ES6 arrow functions. The call returns an array of people and outputs names to the console. The ES6 version is much more concise and arguably simpler. Try it out...in a modern browser :-)

ES5 Version
var callback = function (persons) { 
   persons.map(function (person) {
      console.log(person.name)
   });
};

apex.server.process('get_persons')
   .then(function (data) {
      callback(data);
   });   
ES6 Version
var callback = persons => persons.map(
   person => {console.log(person.name)}
);

apex.server.process('get_persons')
   .then(data => {callback(data)});

For more information on all ES6 features, check out the excellent MDN documentation or the http://es6-features.org/ site.