Essential JavaScript

Word Hunter Kata

Given an array of words, along with a target word, count how many times that word appears in the array.

For example:

const words = [
  'a',
  'chicken',
  'salsa',
  'a',
  'retro',
  'salsa',
  'retro',
  'chicken',
  'chicken'
];
const chickenCount = countWord(words, 'chicken');
console.log(chickenCount); // 3

Code Editor