Skip to content

普通容易理解的方式 #592

@zhangzhangjing

Description

@zhangzhangjing

const arr = [10, 21, 0, -7, 35, 7, 9, 23, 18]
var pos = 0
var num = arr[0]
for (var i = 1; i < arr.length; i++) {
if (arr[i] > 0 && arr[i] < num) {
num = arr[i]
pos = i
}
}
return pos

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions