Code to Parse dollars and cents?
Wouldn't it be simpler to:


strip out any '$' and ',' characters;
convert to a real number;
multiply by 100;
take the integer part.


You can probably do that in one line (my Javascript is a bit rusty):

return Math.round(100 * parseFloat(dollarsAndCentsString.replace(/[$,]/g, '')));


Having said that, I think your f('1000') example is probably wrong: my intuition says I should interpret '1000' as dollars, not cents.