11 lines
341 B
JavaScript
11 lines
341 B
JavaScript
|
|
|
|
// Searching algorithm: Binary search
|
|
// Write function bSearch so that it return the location of target if
|
|
// it is found in array list. If target is not found bSearch returns -1
|
|
function bSearch(list, target)
|
|
{
|
|
}
|
|
|
|
// use the following array to test your function
|
|
let arr = ["Allegator", "Bee", "Bull", "dog", "Ferret", "Tiger", "zebra"] |