The value to search within. Must not be null or undefined; it is coerced to a
string using asString before searching.
The substring to count. It is coerced to a string using asString;
if null or undefined, it is stringified (for example, to "null" or "undefined"). If the
resulting string is empty, 0 is returned.
The number of non-overlapping substring occurrences.
Count the number of non-overlapping occurrences of a substring within the provided value.
Both
valueandsearchStringare converted to strings using asString before searching. If the converted search string is empty, this function returns0to avoid an unbounded match count. Thevalueparameter must not benullorundefined, whilesearchStringmay benullorundefinedand will be stringified (for example, to"null"or"undefined").