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.
#s Sorts JavaScript array in descending order.
#U Removes duplicate items from JavaScript array ( makes array items unique ).
#D Leaves in array only duplicate items.
#LEN Calculates array length.
#A Wraps JavaScript objects and primitives with array. Undefined values convert to empty array. Doesn't take effect on arrays.
#F Resolves the first array element if array has only one item. Otherwise evaluates to undefined value.

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

Watch a demo