Ray.so - Create beautiful code

PHOTO EMBED

Wed Feb 17 2021 17:01:38 GMT+0000 (UTC)

Saved by @tipoidarraga #undefined

module.exports = leftpad;
​
function leftpad(str, len, ch) {
  str = String(str);
  var i = -1;
​
  if (!ch && ch !== 0) ch = ' ';
​
  len = len - str.length;
​
  while (i++ < len) {
    str = ch + str;
  }
  return str;
}
content_copyCOPY

https://ray.so/