title: When I enter 2 letters it searches about one one I would search about 2 letters at once to get value
body: <p><a href="https://i.stack.imgur.com/hEx3l.png" rel="nofollow noreferrer">enter image description here</a>[enter image description here][2]When I enter 2 letters it searches about one one I would search about 2 letters at once to get value</p>
  
  <pre><code>function d() {
    var  keyy = ["ا","ب","ت","ث","ج","ح","خ","د","ذ","ر","ز","س","ش","ص","ض","ط","ظ","ع","غ","ف","ق","ك","ل","م","ن","ه","و","ي"," ",","];
    var  code = ["ي1", "س1", "و1","ع1","ي2","س2","و2","ع2","ي3","س3","و3","ع3","ي4","س4","و4","ع4","ي5","س5","و5","ع5","ي6","س6","و6","ع6","ي7","س7","و7","ع7"," /",","];
  
    var msg=document.getElementById("pop").value;//if value = 1س it Gives unfounded???
  
    var finalcode="";
  
    for (var i = 0, len = msg.length; i &lt; len; i++) 
    {
      var index=code.indexOf(msg[i]); 
  
      if(code[index]==undefined)
        finalcode+=msg[i];
      else
        finalcode+=keyy[index];
    }
  
    document.getElementById("p").innerHTML = finalcode;
  }
  </code></pre>