Discuss / JavaScript / findindex indexof有什么区别

findindex indexof有什么区别

Topic source

OHHOHH121

#1 Created at ... [Delete] [Delete and Lock User]

findindex indexof有什么区别

兔子LZsama

#2 Created at ... [Delete] [Delete and Lock User]

findindex丢进去的是一个函数,找满足函数关系的元素。

indexof丢进去的是要找的元素,直接找元素。

findindex(x=>{return x;})效果和indexof一样,可以处理更复杂的情况吧

□▼□

#4 Created at ... [Delete] [Delete and Lock User]

你的字怎么那么大!


  • 1

Reply