title: How can I know if the characters of a string repeat themselves the same amount of times when they have a wildcard built-in?
body: <p>examples:<br /></p>
  <ul>
  <li><code>testing(&quot;xyzy**&quot;)</code> should be <code>true</code>.<br /></li>
  <li><code>testing(&quot;xyzy*&quot;)</code> should be <code>false</code>.<br /></li>
  </ul>
  <p>Reasoning:</p>
  <ul>
  <li>In the first case, it is true because one <code>*</code> can behave as a <code>x</code> and the other a <code>z</code>, so all characteres would of the same amount of <code>y</code>.<br /></li>
  <li>In the second case there wouldn't be the same amount of characters repeating itself, cause there is only one <code>*</code>, so it is false.</li>
  </ul>
  <p>Here is what I have up until now:</p>
  <pre><code>const testing = string =&gt; {
      var array = []; //array with each character without repeating
      var array_R = []; //array with the value the value that each character repeats itself
      var array_C = 0; //counter for the size of &quot;array&quot;
      
      //getting the character without repeating
      for (var i = 0; i &lt; string.length; i++) {
        if (!array.includes(string.charAt(i))) {
          array[array_C] = string.charAt(i);
          array_R[array_C] = 0;
          array_C++;
        }
      }
      
      //how many each character repeats itself
      for (var i = 0; i &lt; array.length; i++) {
        for (var j = 0; j &lt; string.length; j++) {
          if(array[i] == string.charAt(j)){
            array_R[i] = array_R[i] + 1;
          }
        }
      }
  }
  </code></pre>
  <p>I really don't know how I can proceed from here.</p>