Javascript zero fill
var length = 5;
var number = 15;
new Array(length - number.toString().length + 1).join('0') + number;
Written by Rogério Alencar Lino Filho
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Javascript
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#