Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
Chechnya, Russian Federation
let target = 4
function binary(arr, target) {
let left = 0
let right = arr.length - 1
while(left <= right) {
const mid = Math.floor((left + right) / 2)
if(arr[mid] == target) {
return mid
}
if(arr[mid] < target){
left = mid + 1
}
else {
right = mid - 1
}
}
return -1
}
const result = binary(arrays, target)
console.log(result)
justify-content: space-between;