Modernize for;;-loops
Change-Id: Ic6f86af0d674cc6643fc9eef2aa7431cfdf514f2
diff --git a/dev/js/src/menu/item.js b/dev/js/src/menu/item.js
index e06de1e..f0c531f 100644
--- a/dev/js/src/menu/item.js
+++ b/dev/js/src/menu/item.js
@@ -194,21 +194,22 @@
var len = 0;
// Iterate over all prefixes and get the best one
- for (var i = 0; i < prefixes.length; i++) {
+ // for (var i = 0; i < prefixes.length; i++) {
+ prefixes.forEach(function(i) {
// Get first pos of a matching prefix
- testPos = textlc.indexOf(prefixes[i]);
+ testPos = textlc.indexOf(i);
if (testPos < 0)
- continue;
+ return;
if (pos === -1 || testPos < pos) {
pos = testPos;
- len = prefixes[i].length;
+ len = i.length;
}
- else if (testPos === pos && prefixes[i].length > len) {
- len = prefixes[i].length;
+ else if (testPos === pos && i.length > len) {
+ len = i.length;
};
- };
+ });
// Matches!
if (pos >= 0) {