Counting results in an JavaScript array
<p>How do you count results within an array?</p>

<p>I am counting the occurrences of a pattern in an array and could like it to return as </p>

<pre><code>[0, 0, 0]
</code></pre>

<p>For example with each element of the array representing a search result.</p>

<p>This is what I've done so far... but it seems to only return [object object]...</p>

<pre><code>pages=[
"Lorem Ipsum is simply dummy text of the printing and typesetting industry."
, 
"It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout", 
"There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable." 
]
pattern = prompt("Enter a search string")

    var count = {};

    for(i=0; i&lt;pages.length; i++)
    {
         for(j=0; j&lt;pattern.length; j++)
         {
               if((pages[i].toLowerCase()
                           .indexOf(pattern.toLowerCase()
                                           .charAt([j])))&lt;0)
               {
                  count[i]++;
               }
         }
    }

    alert(count);
</code></pre>
