How do I limit clients to only 4 with the codes below

Hi guys,
Here’s the codes


var clients[];
for(var i = 0; i < clients.length; i++) {
     clients.someFunction();
}

I want only 4 clients at the time.

Thanks

Hi,
Try add break; instruction:

for(var i = 0; i < clients.length; i++) {
  clients.someFunction();
  if(i  == 3) break;
}

Hi,
Thanks for reply. I’ve got it done with the codes below:


var clients[];
for(var i = 0; i < clients.length; i += 4) {
     clients[i].someFunction();
}

If that’s the answer, then the question should have been: “How do I call a method of every fourth element?”.
What you asked was too vague to interpret.

Sorry,
I create a live javascript session for group of my clients discussion. I want to limit group participation to only 4 persons. And that what I can think of at the moment.