Skip to content

getShowCount

String.prototype.getShowCount(needle)

获取指定字符串出现次数。

返回值:Number

参数说明类型可选值默认值
needle待统计字符串String
js
console.log('banana'.getShowCount('c'));