Skip to content

Instantly share code, notes, and snippets.

@Daniel-Wiedemann
Created August 14, 2018 09:27
Show Gist options
  • Save Daniel-Wiedemann/4a7e2f203a2583ec2879db9b4f2c74a3 to your computer and use it in GitHub Desktop.
Save Daniel-Wiedemann/4a7e2f203a2583ec2879db9b4f2c74a3 to your computer and use it in GitHub Desktop.
Pad a number with leading zero in JavaScript
module.exports.pad = (paramNumber) => {
paramNumber < 10 && paramNumber > -1 ? '0' + paramNumber : paramNumber;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment