求助,为什么return undefined??
var arr = [0, 1, 2, 3, 4, 5, 7]; findTheLost = (arr) => { let tempArr = []; if (arr.length === 2) { var result = parseInt(arr[0]) + 1; console.log(result); return result; } if (arr[Math.floor(arr.length / 2) - arr[0]] > arr.length / 2) { tempArr = arr.slice(0, Math.floor(arr.length / 2)); findTheLost(tempArr); } else { tempArr = arr.slice(Math.floor(arr.length / 2), arr.length); findTheLost(tempArr); } }; var temp = findTheLost(arr); console.log(temp);