Some of the features require strict mode. Enable this mode by placing the following code as the very first line of your CloudScript file:
use strict;String interpolation
When composing messages for your players, you may want to use multi-line interpolated strings. Use the back-tick symbol to create an interpolated string. You may then insert data right into the string using${ variable } syntax.
This allows you to avoid string concatenation and improves code readability.
Back-tick strings are verbatim and may be multi-line. This means you have to keep an eye on all indention, as any extra space/tab will be captured into the string.
New methods and arrow functions
ES6 brings new syntax for defining functions using the arrow operator=>. The snippet displayed below shows approximate translations for certain operator usages.
Array.findIndex method, allows searching by predicate with the following well-looking, succinct code.
Object assignment
TheObject.assign method allows you to easily extend any object with a new set of properties and methods.
Having a large variety of usages, this method is particularly useful for extending a handlers object and creating groups of handlers.
Getters
One may use “Getters” to encapsulate common API calls into a more syntactically pleasing look and feel. Consider the following Title Data state. The following snippet shows how to retrieveFoo and Bar data from TitleData and then use them in a very straightforward way.
