Web Effects Array Operation example
<script>
var arr = new Array (1,2,3,4,5,6,7,8,9,10,11,12,13);
function Getsum (n)
{
Return Arr.join ("*"). Replace (new RegExp ([[^*]+[*]) {+ (n-1) + "}[^*]+" [*] "," G ")," $1+ ");
}
Alert (Getsum (3));
</script>
var arr = new Array (1,2,3,4);
If the incoming argument is 2
The result returned is 35 (1*2+1*3+1*4+2*3+2*4+3*4=35)
If the incoming argument is 3
The result returned is 50 (1*2*3+1*2*4+1*3*4+2*3*4=50)
Let's look at a simple example
var clientsids = new Array ( 663,175816,19388,22770,175765,175764,175224,175233,175234,175238,175241,175248,175263,175246,46053,16309);
Function Array_additem (item) {
for (var i = 0; i < clientsids.length; i++) {
&NBSP;&N bsp; if (clientsids[i] = = Item) return;
}
Clientsids.push (item);
}
Function Array_removeitem (item) {
var tmparray = new Array ();
for (var i = 0; i < clientsids.length; i++) {
&nb sp; if (Clientsids[i]!= Item) Tmparray.push (Clientsids[i));
}
clientsids = Tmparray;
}