I'm trying to count the number of common letters between the user's `input` and the number generated. I am counting it so that the placement doesn't matter between them (so 411 and 004 should say "1 number in common"). 

I've placed my `code` in a snippet below. It works fine, except for that, *when the generated `string` has two of the same numbers, it doesn't work properly.* You can see that by typing "4", it will say that there are two chars. in common, when there is really only one (it counts the four twice.)

So, after all this, I'm asking **what is the best way to show the common letters between the `input` and the `generated number?`**

I'm fine with using `jQuery` and/or `JavaScript`, and sorry if my code isn't very good, I'm not very advanced at all. 

Thanks for any help in advance! :)

```js
  // on ".check" click...

$(".check").click(function() {
  var nmb = $(".number").text();
  var ltr = $(".input").val();
  var count = $(".cnt");

  // Set logged text to 0

  count.text("0");

  // Test for numbers in common

  if (ltr.includes(nmb.charAt(0))) {
    count.html(function(i, val) {
      return val * 1 + 1
    });
  }
  if (ltr.includes(nmb.charAt(1))) {
    count.html(function(i, val) {
      return val * 1 + 1
    });
  }
  if (ltr.includes(nmb.charAt(2))) {
    count.html(function(i, val) {
      return val * 1 + 1
    });
  }
  if (ltr.includes(nmb.charAt(3))) {
    count.html(function(i, val) {
      return val * 1 + 1
    });
  }

  $(".res1").html(" numbers in common");
});
```

```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
Generated Number: <span class="number">4410</span><br><br>
<input type="text" class="input" placeholder="Try typing 4 to see the issue" maxlength="4">
<input class="check" type="submit" value="CHECK">
<br><br>
<span id="full_res">
  <span class="cnt"></span>
  <span class="res1"></span>
</span>
```