How to replace digit with comma?

How to replace digit with comma?

Hi All,
 
I have comma seperated string having digits. Following is the sample script.
 
var text='30,31,32,3'
text = text.replace(3, "");
alert(text);

 
Above script has to replace 3 with "" and has to give output like ''30,31,32,'. But above script is giving '0,31,32,3' as the output. How to resolve this issue. Immediate help would be appreciated.
 
Regards,
Hari.