title: Js function that returns a matching letter from 2 strings
body: <p>Function that returns the first letter that is present in both strings that a user submits via 
      an input type text, the strings are separated with a comma. For example:aaaaa,bbbbba--> the matching letter is 'a'because is present in both strings
  Sorry for some italian names but i code in italian</p>
  
  <p>I'm not sure how to continue, i have a for to go throught both strings, but i'm not sure if it's correct</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function Ripetizione() {
    var rip = document.getElementById("string").value;
    if (rip.indexOf(",") == -1) { //check to see if the comma is not present
      alert("Non c'è nessuna virgola");
      return;
    }
  
    var stringa1 = rip.substr(0, rip.indexOf(",")); //this is the string1 before the comma
    var stringa2 = rip.substr(rip.indexOf(",") + 1, rip.length - (stringa1.length + 1)); //this is the second string after the comma
  
    for (i = 0; i &lt;= stringa1.length; i++) { //for cycle to count the elements of the first string
  
  
    }
  
  
    for (k = 0; i &lt;= stringa2.lenght; k++) { //same for the string2
  
    }
  }
  
  Ripetizione()</code></pre>
  </div>
  </div>
  </p>