0. function binarySearch(list, item) {
1. let low = 0;
2. let high = list.length - 1;
3.
4. while (low <= high) {
5. const mid = Math.round((low + high) / 2);
6. const guess = list[mid];
7.
8. if (guess === item) {
9. return mid;
10. }
11. if (guess > item) {
12. high = mid - 1;
13. } else {
14. low = mid + 1;
15. }
16. }
17.
18. return null;
19. }