Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/course-dasheng/fe-algorithm
/ leftpad
Function
leftpad
interview/leftpad.js:8–11 ·
view source on GitHub ↗
(str,length,ch)
Source
from the content-addressed store, hash-verified
6
// console.log(s.padStart(10,'0'))
7
8
function
leftpad(str,length,ch){
9
let
len = length-str.length+1
10
return
Array(len).join(ch)+str
11
}
12
13
console.log(leftpad(
'hello'
,10,
'0'
))
14
Callers
1
leftpad.js
File · 0.85
Calls
no outgoing calls
Tested by
no test coverage detected