title: Illegal Break Statement. NodeJs
body: <p>While Executing the below code. it shows illegal break statement error. I am new to nodejs kindly help me to resolve this.</p>
  
  <p>Code Is:</p>
  
  <pre><code>describe('Locating elements using JS', function () {
              it('Locate H1 tags', function () {
                  browser.get("http://angularjs.org");
                  element.all(by.js(function () {
                      //This is javascript code which will get h1 elements
                      var elementsArray = new Array();
                      var anchors = document.querySelectorAll('h3');
                      for (var i = 0; i &lt; anchors.length; ++i) {
                          if (anchors[i].textContent != '') {
                              elementsArray.push(anchors[i]);
                          }
                      }
                      return elementsArray;
                  })).then(function (webElements) {
                      //prints Number of h1 tags identified
                      console.log(webElements.length);
                      for (var i = 0; i &lt; webElements.length; i++) {
                          webElements[i].getText().then(function (text) {
                              //prints text of each H1 tag
                              console.log(text);
                              //Verifying the text of each h1 tag should not be empty
                              expect(text).not.toBe('');
                              if(text=="Directives"){
                                  break;
                              }
  
                          })
                      }
                  });
              });
          });
  </code></pre>