lmartins
2/22/2014 - 10:16 AM

Add leading zeros to a number if applicable

Add leading zeros to a number if applicable

pad = (num) ->
    ('0'+num).slice(-2)

console.log pad(8)
console.log pad(12)