9. Array operations

Array operations group is intended to perform different data manipulations with JavaScript arrays.

Let's say we have the following JavaScript file with JavaScript array and some primitive variable:
count = 79;

fruits = ['Mango', 'Banana', 'Mango', 'Annona', 'Grape'];

The following table explains each operation and shows examples related to the JavaScript file above:

Operation Explanation Example Result
#S Sorts JavaScript array in ascending order.
${fruits#S}
["Annona","Banana","Grape","Mango","Mango"]
#s Sorts JavaScript array in descending order.
${fruits#s}
["Mango","Mango","Grape","Banana","Annona"]
#U Removes duplicate items from JavaScript array ( makes array items unique ).
${fruits#U}
["Mango","Banana","Annona","Grape"]
#D Leaves in array only duplicate items.
${fruits#D}
["Mango"]
#LEN Calculates array length.
${fruits#LEN}
5
#A Wraps JavaScript objects and primitives with array. Undefined values convert to empty array. Doesn't take effect on arrays.
${count#A}
[79]
#F Resolves the first array element if array has only one item. Otherwise evaluates to undefined value.
${fruits#F}
undefined

All those operations are applicable for arrays ( except #A ) and ignored for others.

Watch a demo