Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/simple_utility/mod.universal.ts>pad0

Useful snippet collection.
Go to Latest
function pad0
import { pad0 } from "https://deno.land/x/simple_utility@v1.3.4/mod.universal.ts";

Create string with zero padding at beginning of number. Output is 2 digits by default.

Examples

Example 1

const num = 8;
const padding = pad0(num);

Parameters

data: number
optional
digit: number
optional
radix: number