当前位置:网站首页>JS prototype. The find () method has no effect on the object array. It is urgent...

JS prototype. The find () method has no effect on the object array. It is urgent...

2022-06-11 11:12:00 zhanyd

 

I am using Array.prototype.find() When the method is used , Found incorrect return on object array , The process is as follows :

roleResourceList It's an array of objects :

 

The data inside is like this :

 

call find() Method :

debugger I saw that it was true 了 , But it finally returns undefined

 

It's amazing that there are trees ?

The original! , You can't compare them directly , Object words , We should compare them in one method :

The result is right !

 

Postscript :

Guided by friends , Originally, just put the curly braces {} Just get rid of it :

 

 

 

Welcome to my official account. : I can program, too

原网站

版权声明
本文为[zhanyd]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206111054046491.html