Im trying to find count the exact number of a child and then add a class to another element matching that class, in this example the parent (it wont be the direct parent where I'm trying to achieve this). 

```js
$(".test").each(function(index, elem) {
  var countchild = $(this).find(".child");
  if (countchild.length > 4) {
    $(".test").addClass("four")
  } else {}
});
```

```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="test">
  <div class="child">1</div>
  <div class="child">2</div>
  <div class="child">3</div>
  <div class="child">4</div>
</div>
```