my_countMatches
 # Intuition  \n\n\n\n\n\n\n\n\n\n\n\n# Code\n\n/**\n * @param {string[][]} items\n * @param {string} ruleKey\n * @param {string} ruleValue\n * @return {number}
<!-- # Intuition -->\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n<!-- # Approach -->\n<!-- Describe your approach to solving the problem. -->\n\n<!-- # Complexity\n- Time complexity: -->\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n<!-- - Space complexity: -->\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/**\n * @param {string[][]} items\n * @param {string} ruleKey\n * @param {string} ruleValue\n * @return {number}\n */\nvar countMatches = function (items, ruleKey, ruleValue) {\n\tlet count = 0;\n\n\tconst keyIndex = [\'type\', \'color\', \'name\'].indexOf(ruleKey);\n\titems.forEach(element => {\n\t\tif (element[keyIndex] === ruleValue) count++;\n\t});\n\n\treturn count;\n};\n```
['JavaScript']