---
id: 6921e10ae2681205b516fbe6
title: Step 10
challengeType: 1
dashedName: step-10
---

# --description--

Now it's time to add the logic to your loop that increments `count` appropriately.

Inside the loop, use a conditional statement to increment `count` by `1` if the variable `word` equals the variable `match`. Otherwise, leave the value of `count` unchanged.

# --hints--

Calling `getMatchedWordCount([], "bar")`, `getMatchedWordCount(["foo"], "bar")`, `getMatchedWordCount(["foo", "bar", "foo"], "bar")`, and `getMatchedWordCount(["foo", "bar", "foo"], "foo")` in that order should each return a value of type `"number"`; instead, it returned values of type `--fcc-actual--`.

```js
const obj = { method: (arg1, arg2) => typeof getMatchedWordCount(arg1, arg2) };
const spy = __helpers.spyOn(obj, 'method');
obj.method([], "bar");
obj.method(["foo"], "bar");
obj.method(["foo", "bar", "foo"], "bar");
obj.method(["foo", "bar", "foo"], "foo");
assert.deepEqual(spy.returns, ["number", "number", "number", "number"]);
spy.restore();
```

`getMatchedWordCount([], "bar")` should return `0`, but it returns `--fcc-actual--`.

```js
const resultString = String(getMatchedWordCount([], "bar"));
assert.strictEqual(resultString, "0");
```

`getMatchedWordCount(["foo"], "bar")` should return `0`, but it returns `--fcc-actual--`.

```js
const resultString = String(getMatchedWordCount(["foo"], "bar"));
assert.equal(resultString, "0");
```

`getMatchedWordCount(["foo", "bar", "foo"], "bar")` should return `1`, but it returns `--fcc-actual--`.

```js
const resultString = String(getMatchedWordCount(["foo", "bar", "foo"], "bar"));
assert.equal(resultString, "1");
```

`getMatchedWordCount(["foo", "bar", "foo"], "foo")` should return `2`, but it returns `--fcc-actual--`.

```js
const resultString = String(getMatchedWordCount(["foo", "bar", "foo"], "foo"));
assert.equal(resultString, "2");
```

# --seed--

## --seed-contents--

```js
function printCharacters(str) {
  for (const char of str) {
    console.log(char);
  }
}
printCharacters("hello");

function getMatchedWordCount(sentence, match) {
  let count = 0;
  
  for (const word of sentence) {
--fcc-editable-region--
    
--fcc-editable-region--
  console.log(`Checking "${word}" against "${match}" | Running count: ${count}`);
  }
  
  return count;
}

console.log(
  getMatchedWordCount(
    ["I", "really", "really", "really", "like", "to", "code"],
    "really"
  )
);
```
