Posted By

jasonseney on 10/15/08


Tagged

String games zeros score


Versions (?)

Add Preceding Zeros to Score


 / Published in: JavaScript
 

Example:

addZeros((549).toString(),7);

Returns:

"0000549"

  1. function addZeros(score,digits) {
  2. if(score.length >= digits) { return score; }
  3. return addZeros("0"+score,digits);
  4. }

Report this snippet  

You need to login to post a comment.