mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2025-07-29 13:13:54 +08:00
Use const
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user