swc/tests/fixture/issue-2091/case1/input/index.js

8 lines
195 B
JavaScript
Raw Normal View History

function test(list) {
let cur = list.findIndex(p => p == 1);
if (!~cur) {
cur = list.findIndex(p => p !== 0);
}
for (const val of list) cur += val.value;
return cur;
}