From e17e9b095a2213105eb158a9c6c7741457ce63f9 Mon Sep 17 00:00:00 2001 From: BenLad <112470050+Ben-lad@users.noreply.github.com> Date: Mon, 20 Feb 2023 07:55:07 +0700 Subject: [PATCH] Changed the BinarySearch component from a function to an arrow function. Changed the BinarySearch component from a function to an arrow function. The original component was defined using the function keyword, but I updated it to use an arrow function instead. This change provides a more concise syntax and also avoids any issues with the binding of the "this" keyword. I have tested the updated component and verified that it works as expected. Thanks for considering this change! --- src/algorithms/search/binary-search/binarySearch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/search/binary-search/binarySearch.js b/src/algorithms/search/binary-search/binarySearch.js index b9e18aab..a7a96727 100644 --- a/src/algorithms/search/binary-search/binarySearch.js +++ b/src/algorithms/search/binary-search/binarySearch.js @@ -9,7 +9,7 @@ import Comparator from '../../../utils/comparator/Comparator'; * @return {number} */ -export default function binarySearch(sortedArray, seekElement, comparatorCallback) { +export default const binarySearch = (sortedArray, seekElement, comparatorCallback) => { // Let's create comparator from the comparatorCallback function. // Comparator object will give us common comparison methods like equal() and lessThen(). const comparator = new Comparator(comparatorCallback);