Count a value
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version.
Count a value
Count how often one value appears in a list.
Loop over the list and compare each item with target. It is the counter pattern again, with the condition item == target, and it works for words as well as numbers.
Write count_value(items, target) that returns how many times target appears in items, without using .count().
Click Run to see the output here.