This commit is contained in:
RiverTwilight 2023-01-06 08:32:10 +08:00
parent 52927cadad
commit 5a24254f6b

View file

@ -2348,7 +2348,7 @@ $$
/* 查找数组 nums 中数字 1 所在索引 */
function findOne(nums) {
for (let i = 0; i < nums.length; i++) {
if (nums[i] == 1) {
if (nums[i] === 1) {
return i;
}
}
@ -2392,7 +2392,7 @@ $$
/* 查找数组 nums 中数字 1 所在索引 */
function findOne(nums: number[]): number {
for (let i = 0; i < nums.length; i++) {
if (nums[i] == 1) {
if (nums[i] === 1) {
return i;
}
}