diff --git a/dev/js/src/api.js b/dev/js/src/api.js
index a92d73d..7a85dc0 100644
--- a/dev/js/src/api.js
+++ b/dev/js/src/api.js
@@ -167,9 +167,9 @@
           return;
         };
 	      if (json !== null && json["errors"] !== null) {
-	        for (var i in json["errors"]) {
-	          KorAP.log(json["errors"][i][0], json["errors"][i][1] || "Unknown");
-	        };
+	        json["errors"].forEach(
+            e => KorAP.log(e[0], e[1] || "Unknown")
+	        );
 	      }
         else if (this.status !== 200) {
         	KorAP.log(this.status, this.statusText);
diff --git a/dev/js/src/hint/foundries/corenlp.js b/dev/js/src/hint/foundries/corenlp.js
index d4279b7..f718679 100644
--- a/dev/js/src/hint/foundries/corenlp.js
+++ b/dev/js/src/hint/foundries/corenlp.js
@@ -1,31 +1,33 @@
-define(["hint/foundries","hint/foundries/stts","hint/foundries/negranodes","hint/foundries/negraedges"],
-       function (ah, sttsArray, negraNodesArray, negraEdgesArray) {
-  var namedEntities = [
-    ["I-LOC",  "I-LOC ",  "Location"],
-    ["I-MISC", "I-MISC ", "Miscellaneous"],
-    ["I-ORG",  "I-ORG ",  "Organization"],
-    ["I-PER",  "I-PER ",  "Person"]
-  ];
+define(
+  ["hint/foundries","hint/foundries/stts","hint/foundries/negranodes","hint/foundries/negraedges"],
+  function (ah, sttsArray, negraNodesArray, negraEdgesArray) {
+    var namedEntities = [
+      ["I-LOC",  "I-LOC ",  "Location"],
+      ["I-MISC", "I-MISC ", "Miscellaneous"],
+      ["I-ORG",  "I-ORG ",  "Organization"],
+      ["I-PER",  "I-PER ",  "Person"]
+    ];
 
-  ah["-"].push(
-    ["CoreNLP", "corenlp/", "Constituency, Named Entities, Part-of-Speech"]
-  );
+    ah["-"].push(
+      ["CoreNLP", "corenlp/", "Constituency, Named Entities, Part-of-Speech"]
+    );
 
-  ah["corenlp/"] = [
-    ["Constituency", "c="],
-    ["Named Entity", "ne=" , "Combined"],
-    ["Named Entity", "ne_dewac_175m_600=" , "ne_dewac_175m_600"],
-    ["Named Entity", "ne_hgc_175m_600=",    "ne_hgc_175m_600"],
-    ["Part-of-Speech", "p="]
-  ];
+    ah["corenlp/"] = [
+      ["Constituency", "c="],
+      ["Named Entity", "ne=" , "Combined"],
+      ["Named Entity", "ne_dewac_175m_600=" , "ne_dewac_175m_600"],
+      ["Named Entity", "ne_hgc_175m_600=",    "ne_hgc_175m_600"],
+      ["Part-of-Speech", "p="]
+    ];
 
-  ah["corenlp/ne="] = namedEntities;
-  ah["corenlp/ne_dewac_175m_600="] = namedEntities;
-  ah["corenlp/ne_hgc_175m_600="] = namedEntities;
-  ah["corenlp/p="] = sttsArray;
-  ah["corenlp/c="] = negraNodesArray;
+    ah["corenlp/ne="] = namedEntities;
+    ah["corenlp/ne_dewac_175m_600="] = namedEntities;
+    ah["corenlp/ne_hgc_175m_600="] = namedEntities;
+    ah["corenlp/p="] = sttsArray;
+    ah["corenlp/c="] = negraNodesArray;
 
-  for (var i in negraNodesArray) {
-    ah["corenlp/c=" + negraNodesArray[i][0] + '-'] = negraEdgesArray;
-  };
-});
+    negraNodesArray.forEach(
+      i => ah["corenlp/c=" + i[0] + '-'] = negraEdgesArray
+    );
+  }
+);
diff --git a/dev/js/src/init.js b/dev/js/src/init.js
index f9eaa13..4482316 100644
--- a/dev/js/src/init.js
+++ b/dev/js/src/init.js
@@ -262,22 +262,20 @@
       };
 
       if (KorAP.koralQuery["errors"]) {
-        var errors = KorAP.koralQuery["errors"];
-        for (var i in errors) {
+        KorAP.koralQuery["errors"].forEach(function(e) {
 
           // Malformed query
-          if (errors[i][0] === 302 && errors[i][2]) {
+          if (e[0] === 302 && e[2]) {
             obj.hint = hintClass.create();
-            obj.hint.alert(errors[i][2], errors[i][1]);
-            break;
+            obj.hint.alert(e[2], e[1]);
           }
 
           // no query
-          else if (errors[i][0] === 301) {
+          else if (e[0] === 301) {
             obj.hint = hintClass.create();
-            obj.hint.alert(0, errors[i][1]);      
+            obj.hint.alert(0, e[1]);      
           }
-        }
+        });
       };
     };
 
diff --git a/dev/js/src/match.js b/dev/js/src/match.js
index 92062cc..7ce2652 100644
--- a/dev/js/src/match.js
+++ b/dev/js/src/match.js
@@ -85,10 +85,9 @@
       else {
 
         // Iterate over allowed match terms
-        for (var i in _matchTerms) {
-          var term = _matchTerms[i];
+        _matchTerms.forEach(function(term) {
           this[term] = match[term] !== undefined ? match[term] : undefined;
-        };
+        }, this);
       };
       
       this._avail = {
diff --git a/dev/js/src/match/meta.js b/dev/js/src/match/meta.js
index c4cd63f..78b1430 100644
--- a/dev/js/src/match/meta.js
+++ b/dev/js/src/match/meta.js
@@ -56,12 +56,9 @@
       };
       
       // TODO: Meta fields should be separated
-      const keys = Object.keys(posInMetaArray);
-
       // Sort all meta keys alphabetically
-      for (let i in keys.sort()) {
-        let k = keys[i];                             // This is the title
-        let field = fields[posInMetaArray[keys[i]]]; // This is the object
+      Object.keys(posInMetaArray).sort().forEach(function(k) {
+        let field = fields[posInMetaArray[k]]; // This is the object
 
         // Ignore internal IDs
         if (k !== "UID" &&
@@ -111,7 +108,7 @@
           
           metaDL.appendChild(metaL);
         };
-      };
+      });
 
       // Add corpusByMatch assistant
       this._corpusByMatch = cbmClass.create(this._element);
diff --git a/dev/js/src/match/querycreator.js b/dev/js/src/match/querycreator.js
index 8c60ff8..fa4917b 100644
--- a/dev/js/src/match/querycreator.js
+++ b/dev/js/src/match/querycreator.js
@@ -405,13 +405,9 @@
       };
 
       // Set query language field
-      var qlf = this._ql.options;
-      for (var i in qlf) {
-	      if (qlf[i].value == 'poliqarp') {
-	        qlf[i].selected = true;
-          break;
-	      };
-      };
+      const ql = this._ql.options.find(e => e.value == 'poliqarp');
+      if (ql)
+        ql.selected = true;
 
       // Insert to query bar
       this._q.value = this.toString();
diff --git a/dev/js/src/match/table.js b/dev/js/src/match/table.js
index 3ad2731..9078780 100644
--- a/dev/js/src/match/table.js
+++ b/dev/js/src/match/table.js
@@ -104,8 +104,7 @@
     _parse : function (children, mark) {
 
       // Get all children
-      for (var i in children) {
-        var c = children[i];
+      children.forEach(function(c) {
 
         // Create object on position unless it exists
         if (this._info[this._pos] === undefined) {
@@ -180,7 +179,7 @@
             this._token[this._pos++] = c.nodeValue;
           };
         };
-      };
+      }, this);
 
       delete this._info[this._pos];
     },
@@ -250,7 +249,7 @@
       tr.addCell('th', undefined, 'Layer');
 
       // Add tokens
-      for (var i in this._token) {
+      Object.keys(this._token).forEach(function(i) {
         let surface = this.getToken(i);
         var c = tr.addCell('th', undefined, surface);
         if (this._mark[i]) {
@@ -267,7 +266,7 @@
         if (surface.length > 20) {
           c.setAttribute("title", surface)
         }
-      };
+      }, this);
       
       var tbody = table.addE('tbody');
 
diff --git a/dev/js/src/match/treearc.js b/dev/js/src/match/treearc.js
index 6f0690b..2acda9b 100644
--- a/dev/js/src/match/treearc.js
+++ b/dev/js/src/match/treearc.js
@@ -61,8 +61,7 @@
       // Iterate over edge lists
       // TODO:
       //   Support spans for anchors!
-      for (var i in edges) {
-        var edge = edges[i];
+      edges.forEach(function(edge) {
 
         // Check the target identifier
         var targetID = edge.targetID;
@@ -88,7 +87,7 @@
           // console.log(relation);
           this.addRel(relation);
         };
-      };
+      }, this);
 
       // Reset parsing memory
       this.temp = {};
@@ -100,8 +99,7 @@
     _parse : function (parent, children, mark) {
 
       // Iterate over all child nodes
-      for (var i in children) {
-        var c = children[i];
+      children.forEach(function(c) {
 
         // Element node
         if (c.nodeType == 1) {
@@ -230,8 +228,8 @@
               this.temp['pos']++;
             };
           };
-        }
-      };
+        };
+      }, this);
 
       // Todo: define edges here!
     },
@@ -612,13 +610,7 @@
 
       // Add sorted arcs and anchors
       this._sortedArcs    = lengthSort(sortedArcs, false);
-
-      // Translate map to array (there is probably a better JS method)
-      var sortedAnchors = [];
-      for (var i in anchors) {
-        sortedAnchors.push(anchors[i]);
-      };
-      this._sortedAnchors = lengthSort(sortedAnchors, true);
+      this._sortedAnchors = lengthSort(Object.keys(anchors), true);
     },
 
     /**
@@ -671,18 +663,18 @@
       ws.style.textAnchor = "start";
       
       var lastRight = 0;
-      for (var node_i in this._tokens) {
+      this._tokens.forEach(function(node_i) {
         // Append svg
         // var x = text.appendChild(this._c("text"));
         var tspan = text.appendChild(this._c("tspan"));
-        tspan.appendChild(d.createTextNode(this._tokens[node_i]));
+        tspan.appendChild(d.createTextNode(node_i));
         tspan.setAttribute("text-anchor", "middle");
         
         this._tokenElements.push(tspan);
 
         // Add whitespace!
         tspan.setAttribute("dx", this.tokenSep);
-      };
+      }, this);
 
       // Get some global position data that may change on resize
       var globalBoundingBox = this._rect(g);
@@ -702,15 +694,14 @@
         this._sortArcs();
 
       // 1. Draw all anchors
-      var i;
-      for (i in this._sortedAnchors) {
-        this._drawAnchor(this._sortedAnchors[i]);
-      };
+      this._sortedAnchors.forEach(
+        i => this._drawAnchor(i)
+      );
 
       // 2. Draw all arcs
-      for (i in this._sortedArcs) {
-        this._drawArc(this._sortedArcs[i]);
-      };
+      this._sortedArcs.forEach(
+        i => this._drawArc(i)
+      );
 
       // Resize the svg with some reasonable margins
       var width = this._rect(text).width;
diff --git a/dev/js/src/match/treehierarchy.js b/dev/js/src/match/treehierarchy.js
index e9c6122..0a7bf49 100644
--- a/dev/js/src/match/treehierarchy.js
+++ b/dev/js/src/match/treehierarchy.js
@@ -109,8 +109,7 @@
 
     // Parse the snippet
     _parse : function (parent, children, mark) {
-      for (var i in children) {
-       var c = children[i];
+      children.forEach(function(c) {
 
        // Element node
        if (c.nodeType == 1) {
@@ -164,7 +163,7 @@
 
            this._addEdge(parent, id);
          };
-      };
+      }, this);
       return this;
     },
 
diff --git a/dev/js/src/menu.js b/dev/js/src/menu.js
index 3c2fff8..d0ce49a 100644
--- a/dev/js/src/menu.js
+++ b/dev/js/src/menu.js
@@ -175,14 +175,14 @@
 
       var i = 0;
       // Initialize item list based on parameters
-      for (i in list) {
-        var obj = this._itemClass.create(list[i]);
+      list.forEach(function(i){
+        var obj = this._itemClass.create(i);
 
         // This may become circular
         obj["_menu"] = this;
-        this._lengthField.add(list[i]);
+        this._lengthField.add(i);
         this._items.push(obj);
-      };
+      }, this);
 
       this._slider.length(this.liveLength())
         .limit(this._limit)
@@ -296,9 +296,9 @@
         delete this._element["menu"]; 
 
       // Remove circular reference to "this" in items
-      for (var i = 0; i < this._items.length; i++) {
-        delete this._items[i]["_menu"];
-      };
+      this._items.forEach(function(i) {
+        delete i["_menu"];
+      });
 
       // Remove circular reference to "this" in prefix
       delete this._prefix['_menu'];
@@ -854,11 +854,11 @@
 
     // Unmark all items
     _unmark : function () {
-      for (var i in this._list) {
-        var item = this._items[this._list[i]];
+      this._list.forEach(function(it){
+        var item = this._items[it];
         item.lowlight();
-        item.active(false);  
-      };
+        item.active(false);
+      }, this);
     },
 
     // Set boundary for viewport
@@ -903,7 +903,7 @@
         var shown = 0;
         var i;
 
-        for (i in this._list) {
+        for (let i = 0; i < this._list.length; i++) {
 
           // Don't show - it's before offset
           shown++;
diff --git a/dev/js/src/panel.js b/dev/js/src/panel.js
index eee7a00..f9fb979 100644
--- a/dev/js/src/panel.js
+++ b/dev/js/src/panel.js
@@ -104,11 +104,10 @@
      * Delete a closed view from panel
      */
     delView : function (view) {
-      for (i in this.views) {
-        if (this.views[i] === view) {
-          this.views[i] = undefined;
-        }
-      }
+      this.views.forEach(function(e, i, a) {
+        if (e === view)
+          a[i] = undefined;
+      });
     },
 
     /**
diff --git a/dev/js/src/panel/match.js b/dev/js/src/panel/match.js
index c901cee..a6c50db 100644
--- a/dev/js/src/panel/match.js
+++ b/dev/js/src/panel/match.js
@@ -87,9 +87,7 @@
         if (matchButtons) {
 
           // Add all matchbuttons in order
-          for (i in matchButtons) {
-            a.add.apply(a, matchButtons[i]);
-          }
+          matchButtons.forEach(m => a.add.apply(a, m));
         };
       };
 
@@ -142,13 +140,8 @@
       var spans = match.getSpans();
       var rels = match.getRels();
       
-      var i;
-      for (i in spans) {
-        treeLayers.push(spans[i]);
-      };
-      for (i in rels) {
-        treeLayers.push(rels[i]);
-      };
+      spans.forEach(i => treeLayers.push(i));
+      rels.forEach(i => treeLayers.push(i));
 
       // Get spans
       treeLayers = treeLayers.sort(
diff --git a/dev/js/src/panel/query.js b/dev/js/src/panel/query.js
index f0f1920..7f66f9f 100644
--- a/dev/js/src/panel/query.js
+++ b/dev/js/src/panel/query.js
@@ -27,9 +27,7 @@
         var queryButtons = KorAP.Plugin.buttonGroup("query");
 
         // Add all matchbuttons in order
-        for (i in queryButtons) {
-          a.add.apply(a, queryButtons[i]);
-        };
+        queryButtons.forEach(i => a.add.apply(a, i));
 
         KorAP.Plugin.clearButtonGroup("query")
       };
diff --git a/dev/js/src/panel/result.js b/dev/js/src/panel/result.js
index d221081..3c5dc31 100644
--- a/dev/js/src/panel/result.js
+++ b/dev/js/src/panel/result.js
@@ -30,9 +30,7 @@
         var resultButtons = KorAP.Plugin.buttonGroup("result");
 
         // Add all result buttons in order
-        for (i in resultButtons) {
-          this.actions.add.apply(this.actions, resultButtons[i]);
-        };
+       resultButtons.forEach(i => this.actions.add.apply(this.actions, i));
 
         KorAP.Plugin.clearButtonGroup("result");
       };
diff --git a/dev/js/src/plugin/server.js b/dev/js/src/plugin/server.js
index 76ac11d..e47cfbf 100644
--- a/dev/js/src/plugin/server.js
+++ b/dev/js/src/plugin/server.js
@@ -125,8 +125,7 @@
  
       // Embed all embeddings of the plugin
       var that = this;
-      for (let i in obj["embed"]) {
-        let embed = obj["embed"][i];
+      obj["embed"].forEach(function(embed) {
 
         if (typeof embed !== 'object')
           throw new Error("Embedding of plugin is no object");
@@ -274,7 +273,7 @@
 
           plugin["services"].push(id);
         };
-      };
+      }, this);
     },
 
     // TODO:
@@ -322,7 +321,7 @@
         
         // Every second increase the limits of all registered services
         this._timer = window.setInterval(function () {
-          for (var i in limits) {
+          for (let i = 0; i < limits.length; i++) {
             if (limits[i]++ >= maxMessages) {
               limits[i] = maxMessages;
             }
@@ -558,16 +557,16 @@
     // Destructor, just for testing scenarios
     destroy : function () {
       limits = {};
-      for (let s in services) {
-        services[s].close();
-      };
+      Object.keys(services).forEach(
+        s => services[s].close()
+      );
       services = {};
-      for (let b in buttons) {
-        buttons[b] = [];
-      };
-      for (let b in buttonsSingle) {
-        buttonsSingle[b] = [];
-      };
+      Object.keys(buttons).forEach(
+        b => buttons[b] = []
+      );
+      Object.keys(buttonsSingle).forEach(
+        b => buttonsSingle[b] = []
+      );
 
       if (this._element) {
         let e = this._element;
diff --git a/dev/js/src/selectMenu.js b/dev/js/src/selectMenu.js
index 9f447ca..4db1dcd 100644
--- a/dev/js/src/selectMenu.js
+++ b/dev/js/src/selectMenu.js
@@ -50,9 +50,7 @@
 	      obj._container.addEventListener('click', obj.showSelected.bind(obj));
 
 	      // Add index information to each item
-	      for (i in obj._items) {
-	        obj._items[i]._index = i;
-	      };
+	      obj._items.forEach((e,i) => e._index = i);
 
 	      // This is only domspecific
 	      obj.element().addEventListener('blur', function (e) {
@@ -89,8 +87,7 @@
        */
       selectValue : function (vParam) {
         var qlf = this._select.options;
-        var i;
-        for (i in qlf) {
+        for (let i = 0; i < qlf.length; i++) {
 	        if (qlf[i].value == vParam) {
             this.hide();
             this.select(i);
diff --git a/dev/js/src/state.js b/dev/js/src/state.js
index 78cd4cc..a5ab7d8 100644
--- a/dev/js/src/state.js
+++ b/dev/js/src/state.js
@@ -54,9 +54,7 @@
     set : function (value) {
       if (value != this.value) {
         this.value = value;
-        for (let i in this._assoc) {
-          this._assoc[i].setState(value);
-        }
+        this._assoc.forEach(i => i.setState(value));
       };
     },
 
diff --git a/dev/js/src/vc.js b/dev/js/src/vc.js
index 6cd3c00..764ed96 100644
--- a/dev/js/src/vc.js
+++ b/dev/js/src/vc.js
@@ -233,10 +233,10 @@
 
       // Check recursively
       else if (obj.ldType() === 'docGroup') {
-        for (var i in obj.operands()) {
-          if (this.wasRewritten(obj.getOperand(i))) {
-            return true;
-          }
+
+        // If there was a rewritten object
+        if (obj.operands().find(op => this.wasRewritten(op)) !== undefined) {
+          return true;
         };
       };
 
diff --git a/dev/js/src/vc/docgroup.js b/dev/js/src/vc/docgroup.js
index 3a22034..af49191 100644
--- a/dev/js/src/vc/docgroup.js
+++ b/dev/js/src/vc/docgroup.js
@@ -117,14 +117,13 @@
 
 	      // Flatten group
 	      if (docGroup.operation() === this.operation()) {
-	        for (var op in docGroup.operands()) {
-	          op = docGroup.getOperand(op);
+          docGroup.operands().forEach(function(op) {
 	          var dupl = this._duplicate(op);
 	          if (dupl === null) {
 	            this._operands.push(op);
 	            op.parent(this);
 	          };
-	        };
+	        }, this);
 	        docGroup._operands = [];
 	        docGroup.destroy();
 	        return this;
@@ -275,11 +274,10 @@
 	          this._operands.splice(i, 1);
 
 	          // Inject new operands
-	          for (var op in newOp.operands().reverse()) {
-	            op = newOp.getOperand(op);
+            newOp.operands().reverse().forEach(function(op) {
 	            this._operands.splice(i, 0, op);
 	            op.parent(this);
-	          };
+	          }, this);
 	          // Prevent destruction of operands
 	          newOp._operands = [];
 	          newOp.destroy();
@@ -337,10 +335,7 @@
       };
 
       // Add all documents
-      for (var i in json["operands"]) {
-	      var operand = json["operands"][i];
-	      this.append(operand);
-      };
+      json["operands"].forEach(i => this.append(i));
       
       return this;
     },
diff --git a/dev/js/src/vc/fragment.js b/dev/js/src/vc/fragment.js
index f0c1397..ccc121e 100644
--- a/dev/js/src/vc/fragment.js
+++ b/dev/js/src/vc/fragment.js
@@ -142,9 +142,7 @@
         root.setAttribute('class','docGroup');
         root.setAttribute('data-operation', 'and');
 
-        for (let i in this._operands) {
-          root.appendChild(_doc(this._operands[i]));
-        };
+        this._operands.forEach(i => root.appendChild(_doc(i)));
       }
       else if (l == 1) {
         root = _doc(this._operands[0]);
diff --git a/dev/js/src/vc/menu.js b/dev/js/src/vc/menu.js
index 0f0d92a..f2f4b2f 100644
--- a/dev/js/src/vc/menu.js
+++ b/dev/js/src/vc/menu.js
@@ -44,11 +44,9 @@
      * VCs and small key lists.
      */
     typeOf : function (key) {
-      for (i in this._items) {
-        if (this._items[i].key() === key) {
-          return this._items[i].type();
-        }
-      };
+      const found = this._items.find(i => i.key() === key);
+      if (found)
+        return found.type();
     }
   };
 });
diff --git a/dev/js/src/vc/rewritelist.js b/dev/js/src/vc/rewritelist.js
index 9a87e4e..75f3d27 100644
--- a/dev/js/src/vc/rewritelist.js
+++ b/dev/js/src/vc/rewritelist.js
@@ -37,9 +37,8 @@
       this._element = document.createElement('div');
       this._element.setAttribute('class', 'rewrite');
       var comments = [];
-      for (var x in this._list) {
-	      var rewrite = this._list[x];
-
+      this._list.forEach(function(rewrite) {
+	    
         // This is a blind element
 	      var span = document.createElement('span');
 
@@ -60,7 +59,7 @@
         comments.push(rewriteText + ' (' + rewrite.operation() + ')');
         
 	      this._element.appendChild(span);
-      };
+      }, this);
       this._element.setAttribute("title", comments.join("\n"))
       return this._element;
     }
