mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-09-20 07:43:04 +08:00
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!
This commit is contained in:
parent
af08253a95
commit
e17e9b095a
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user