Javascript Array.find方法有时返回项目,有时未定义

我有一个看起来像这样的数组:

const list = [["GET", /github/g]];

它是一个带有子数组的数组,索引0具有字符串,索引1具有正则表达式。

我正在尝试做这样的事情:

function checkList() {
    return list.find(i => i[0] === "GET" && i[1].test("github.com"));
}

Which I would expect to return the list it finds every time, but that's not the case, it flips back and forth from returning the list and returning undefined.

这是一个例子:

let i = 1;
const list = [["GET", /github/g]];
while (i <=10) {
    console.log(list.find(i => i[0] === "GET" && i[1].test("github.com")))
    i++
}

In this example I just loop through it and log the results to show that it returns the list and undefined every other time. What's going on here?