How many commas are detected in the js string?

for example, the string adas, in this paragraph is big. There are Chinese and English commas in asdasda,asda. It is a bit troublesome to use indexOf. Can the rule be detected? please give an example

.
let  str = "adas,asdasda,asda"
str.indexOf()
Mar.29,2021

the simplest

let str = "adas,asdasda,asda";
console.log(str.split(',').length)

let matched = 'adas,asdasda,asda'.match(/,|/g) || [];
// _> matched.length
Menu