检测字符串排序,错误返回相应的数字
function findMissingNumber(sequence){ //your code here if(sequence.length===0) { return 0; } let numbersArr = sequence.split(" "); if(numbersArr[0]==1) { for (var i=1;i<numbersArr.length;i++) { if (numbersArr[i] === "a") { return i; } if(numbersArr[i] != (i+1)) { return (i+1); } } return 0 }else { return 1 } }
题目