Article From:

In nodejs, the array.find function is called, which returns -1, and does not jump into the find function, but the same code can get parameters in the browser, and my node is

The code I used in vscode and vscode executed a random code and interrupted the input.

Browser environment

I think this is not related to the code, I copy the file to the students, run, return the result is the same as on the MDN, and I can not, he said that he had encountered this problem, may be related to the node version, but I used Vue to write components, also used to find, use positiveChang, so I don’t know what is happening to me. Is anyone experiencing the same problem?

Answer 0:

I used the findIndex method directly

Answer 1:

If I can’t find a qualified one, find should return to undefined. I don’t know what the reason is without code.

Answer 2:

It’s not return c===2; is it?

Leave a Reply

Your email address will not be published. Required fields are marked *