function count(arr, value) {
    let count = 0;
    for (const v of arr) {
        if (v === value) ++count;
    }
    return count;
}
Count the occurrences of a value in an array or string.
This mimics the behavior of Python's `count` method.
@param {any[]|string} arr The array or string to search.
@param {any} value The value to count.