JSFiddle - React, Tailwind, and code Playground

by Rahul Tripathi

JavaScript

String.prototype.pad = function pad(str, max) {
    str = str.toString();
  return str.length < max ? pad("0" + str, max) : str;
};

var s = "123";
alert(s.pad(123,10));