4. Type casting operation

nexl allows to perform a type casting directly in expression(s).
There are following 3 base data types you can use in nexl expressions:
Type casting operation applicable only for primitive data types and will be ignored for others.

Let's say we have a following string variable declared somewhere in a JavaScript file:
distanceToTheMoon = '384.400';
The following expression casts that string to a number:
If a primitive type cannot be casted to another primitive type the result will be undefined value:

Let's say we have a colors JavaScript array:
colors = [ 'red', 'green' 'blue' ];
Type casting operation will be ignored if we try to cast that array to a primitive data type:

There are 2 additional operations to produce a null and undefined values in nexl expressions:
:undefined ( or :u )
For example the following expression will be always evaluated to null value:

Watch a demo