Q:

can jquery do this?

$.each(3,function(i){
    alert(i)
    })

alert 0,1,2
how to do this using jquery?
thanks

A:

Is this question for another type of example?  If not, why not just use a plain old boring javascript loop?
for( var i=0; i<3; i++ ) {
    alert(i);
}

What have I missed?

A:

$.each iterates over an array or object, so you'd want to make an array...
$.each([0,1,2],function(i){alert(i);});

Edit: If you want a function to make the array for you, up to a maximum number, here's one way:
max=5;

$.each(
  (function(){ i=0,f=[]; while(i<max){ f.push(i);i++; } return f;})(),
  function(i){ alert(i); }
  );

