title: Having trouble solving this JavaScript coding challenge from coderbyte
body: <p>I'm attempting to solve the following problem from coderbyte.com:</p>
  
  <blockquote>
    <p>Using the JavaScript language, have the function SimpleSymbols(str) take the str parameter being passed and determine if it is an acceptable sequence by either returning the string true or false. The str parameter will be composed of + and = symbols with several letters between them (ie. ++d+===+c++==a) and for the string to be true each letter must be surrounded by a + symbol. So the string to the left would be false. The string will not be empty and will have at least one letter.</p>
  </blockquote>
  
  <p>The following is my attempt:</p>
  
  <pre><code>function SimpleSymbols(str) { 
  
    // code goes here  
  var abc = 'abcdefghijklmnopqrstuvwxyz';
  
  for (var i = 0; i &lt; str.length; i++) {
      if (abc.indexOf(str[i]) !== -1) {
          if (str[i-1] + str[i+1] === "++") {
              return true;
          }
          else {
              return false;
          }
      }
  }
  
  }
  </code></pre>
  
  <p>This works for the following cases:</p>
  
  <pre><code>SimpleSymbols("+a+d+"); // true 
  SimpleSymbols("+ab+d+"); // false
  SimpleSymbols("b+d+"); // false
  </code></pre>
  
  <p>The only case I have found where this doesn't provide the right answer is when there is a trailing letter, for example:</p>
  
  <pre><code>SimpleSymbols("+a+b"); // true
  </code></pre>
  
  <p>This returns true, when in fact it should return false.</p>
  
  <p>NB: I'm assuming string will be lowercase... I haven't dealt with case sensitivity, but I'd like to get the lowercase version working and then I will make it case independent. </p>
  
  <p>Any ideas on what is wrong with my code?</p>