mirror of
https://github.com/swc-project/swc.git
synced 2024-12-18 19:21:33 +03:00
8 lines
195 B
JavaScript
8 lines
195 B
JavaScript
|
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;
|
||
|
}
|