From 71485cbd5d3fee0846db30982b040ec27d5c7f1d Mon Sep 17 00:00:00 2001
From: joni <johnfshaughnessy@gmail.com>
Date: Thu, 7 Jun 2018 13:08:14 -0700
Subject: [PATCH] Change forEach to regular for loops

---
 src/components/look-on-mobile.js  |  5 ++++-
 src/utils/touch-events-handler.js | 12 +++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/components/look-on-mobile.js b/src/components/look-on-mobile.js
index 94288df1d..1d62ca9c6 100644
--- a/src/components/look-on-mobile.js
+++ b/src/components/look-on-mobile.js
@@ -34,7 +34,10 @@ const difference = (curr, prev) => {
 
 const average = a => {
   let sum = 0;
-  a.forEach(n => (sum += n));
+  for (let index of a) {
+    const n = a[index];
+    sum += n;
+  }
   return sum / a.length;
 };
 
diff --git a/src/utils/touch-events-handler.js b/src/utils/touch-events-handler.js
index 9f82888d5..5b6341cfc 100644
--- a/src/utils/touch-events-handler.js
+++ b/src/utils/touch-events-handler.js
@@ -40,7 +40,9 @@ export default class TouchEventsHandler {
   }
 
   handleTouchStart(e) {
-    Array.prototype.forEach.call(e.changedTouches, this.singleTouchStart);
+    for (let i = 0; i < e.changedTouches.length; i++) {
+      this.singleTouchStart(e.changedTouches[i]);
+    }
   }
 
   singleTouchStart(touch) {
@@ -58,7 +60,9 @@ export default class TouchEventsHandler {
   }
 
   handleTouchMove(e) {
-    Array.prototype.forEach.call(e.touches, this.singleTouchMove);
+    for (let i = 0; i < e.touches.length; i++) {
+      this.singleTouchMove(e.touches[i]);
+    }
     if (this.needsPinch) {
       this.pinch();
       this.needsPinch = false;
@@ -123,7 +127,9 @@ export default class TouchEventsHandler {
   }
 
   handleTouchEnd(e) {
-    Array.prototype.forEach.call(e.changedTouches, this.singleTouchEnd);
+    for (let i = 0; i < e.changedTouches.length; i++) {
+      this.singleTouchEnd(e.changedTouches[i]);
+    }
   }
 
   singleTouchEnd(touch) {
-- 
GitLab