title: StringBuilder in For Loop
body: <p>I have this JSON</p>
  
  <pre><code>{
      "elements": [{
              "company": "Microsoft",
              "isValid": "yes"
          }, {
              "company": "Google",
              "isValid": "no"
          }, {
              "company": "Apple",
              "isValid": "yes"
          }
      ]
  }
  </code></pre>
  
  <p>And I would like to build a string output that is like this</p>
  
  <pre><code>Microsoft is OK
  
  Google is NOT OK
  
  Apple is OK
  </code></pre>
  
  <p>If isValid = yes, then it is 'IS NOT OK'. Else it is 'OK'</p>
  
  <p>Here my code</p>
  
  <pre><code>for (i in result) {
   var output = new StringBuilder();
   if (result[i].isValid == "yes") {
      output.append(result[i].company);
      output.append(" is OK\n");
    } else {
          output.append(result[i].company);
      output.append(" is NOT OK\n");
    }
  }
  console.log(output.toString());
  </code></pre>
  
  <p>But output is only the last one (Apple is OK);</p>
  
  <p>PLease help</p>