From 0f78cf3657834b468857d51f20b4f6c2b3b94b22 Mon Sep 17 00:00:00 2001 From: Tay Yang Shun Date: Sat, 30 Sep 2017 21:55:53 +0800 Subject: [PATCH] Use const --- utilities/javascript/binarySearch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/javascript/binarySearch.js b/utilities/javascript/binarySearch.js index 5861eec7..8a656af0 100644 --- a/utilities/javascript/binarySearch.js +++ b/utilities/javascript/binarySearch.js @@ -2,7 +2,7 @@ function binarySearch(arr, target) { let left = 0; let right = arr.length - 1; while (left <= right) { - let mid = left + Math.floor((right - left) / 2); + const mid = left + Math.floor((right - left) / 2); if (arr[mid] === target) { return mid; }