I have to check if a string inside a variable has **all** the strings inside an **array** on it. Very simple I thing, but I cant get it to work! I have tried a lot of things but are to complex and not really working. I'm looking to some suggestion.

Something like:

```
var myArray = ["cat","dog","bird"];
var myString = "There is a cat looking the bird and a dog looking the cat";
var myString2 = "There is a cat and a dog looking one each other";

```

myArray and **myString** must be true and **true** and myArray and **myString2** must result **false**

I was working with something like this:

```
var selector = "dir.class#id";
var code = '<div id="id" class="class"></div>';
var tokens = selector.split(/[\.,#]+/);

for (var i = tokens.length - 1; i >= 0; i--) {
    var counter = [];
    if (code.indexOf(tokens[0]) > -1 ) {
        counter.concat(true);
    }
}

```

Thanks!