title: A loop seems to never break/system is overloaded
body: <p>At school, we have to write a function that would encrypt a certain message by moving each letter of the message by an 'nC' (or niveauCryptage) number in the alphabet.</p>
  <p>Currently, whenever I execute the code, I am stuck on a forever loading screen after completing both of the user interactions (the ones that ask the number by which the letters will be shifted in the alphabet &amp; the message the user wants to encrypt). I suspect that something is wrong with the loops.</p>
  <pre class="lang-js prettyprint-override"><code>function crypter(t, l, nC) {
      //This function receives the alphavet Table, a letter, and the number by which the letter has to be shifted in the alphabet.
      //This function returns a single crypted letter...
      var crypte = '';
      var i = 0;
  
      while (t[i] != l) {
          i++;
      }
  
      if (i + nC &gt; t.length) {
          crypte = (i + nC) - (t.length);
      } else {
          crypte = i + nC;
      }
  
      return crypte;
  }
  
  //Global variables
  var tAlphaB = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
      'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' '
  ];
  var niveauCryptage = 0;
  var texteBase = '';
  var tTexteAvant = new Array();
  var tTexteApres = [];
  var txt = 'Le résultat du cryptage est : \n\n';
  
  //Main program
  //Ask the user to specify the number by which the letters of the message have to be shifted in the alphabet
  //This number has to be a number between 1 and 10 (1 and 10 included)
  do {
  
      niveauCryptage = parseFloat(prompt(&quot;Saisissez un nombre entre 1 et 10 pour selectionner le niveau de cryptage&quot;));
  
  } while (isNaN(niveauCryptage) || niveauCryptage &gt; 10 || niveauCryptage &lt; 1)
  
  
  //Ask the user to enter a message on the condition that it is a chain of characters
  do {
      texteBase = prompt(&quot;Quel texte voudrez-vous crypter?&quot;);
  
  } while (!isNaN(texteBase))
  
  //Transform the message into the table tTexteAvant using the split('') function
  tTexteAvant = new Array(texteBase.split(''));
  
  //Encrypt each letter of the table, tTexteAvant, into a new table, tTexteApres          
  var j = 0;
  while (j &lt; tTexteAvant.length) {
      tTexteApres.push(crypter(tAlphaB, tTexteAvant[j], niveauCryptage));
      j++;
  
  }
  </code></pre>