javascript
```\nvar countMatches = function(items, ruleKey, ruleValue) {\n    const types = {\n        "type": 0,\n        "color": 1,\n        "name": 2\n    }\n    \n   
```\nvar countMatches = function(items, ruleKey, ruleValue) {\n    const types = {\n        "type": 0,\n        "color": 1,\n        "name": 2\n    }\n    \n    return items.filter((item) => {\n        return item[types[ruleKey]] === ruleValue;\n    }).length;\n};
[]