Skip to content

trimLeft

String.prototype.trimLeft([needle])

去除开头字符。

返回值:String

参数说明类型可选值默认值
needle可为空,默认去除空白符。
可指定要去除字符,多个字符使用英文逗号分隔
String
js
console.log(' 123 '.trimLeft());
console.log(' ca123ca '.trimLeft(' ,c,a'));