@Unique (JavaScript)
Returns a random, unique text value (no parameter), or removes duplicate values from a list (parameter).
Defined in
@Functions (JavaScript)Syntax
@Unique() : string
@Unique(list:any)
: any
Parameter | Description |
---|---|
list |
A list you wish to remove duplicate values from. |
Return value | Description |
---|---|
string |
A random, unique text value. |
any |
The list with duplicate values removed. |
Examples
(1) This example generates 16 random numbers.function p(stuff) {
print("<<<" + stuff + ">>>");
}
for(var i = 0; i < 16; i++) {
p(@Unique());
}
/* Typical output - each set of random numbers will be different
<<<1mg6q84zlxj4>>>
<<<nr0c4d9kledc>>>
<<<r99sgrz4nabk>>>
<<<n1m2em3vpjwg>>>
<<<17adehz6fjk74>>>
<<<1x1zziieshk3k>>>
<<<ts3symq0itxc>>>
<<<lcd0v8qx1slc>>>
<<<7szxv67dolj4>>>
<<<1ehmqvydv9m9s>>>
<<<1qgi5shnfjv9c>>>
<<<wexh8es5p0jk>>>
<<<12w43nma5t1xc>>>
<<<m9qzkrkya5fk>>>
<<<51tbn0z73bi8>>>
<<<ne5jfupnojk0>>>
*/
(2) This example removes duplicate values from a list.
function p(stuff) {
print("<<<" + stuff + ">>>");
}
var cities = @List("Paris", "Berlin", "Paris", "Moscow",
"Paris", "London", "Moscow");
cities = @Unique(cities);
for(var i = 1; i <= @Count(cities); i++) {
p(@Element(cities, i));
}
/*
<<<Paris>>>
<<<Berlin>>>
<<<Moscow>>>
<<<London>>>
*/