azl397985856 / fe-interview

宇宙最强的前端面试指南 (https://lucifer.ren/fe-interview)
Apache License 2.0
2.83k stars 260 forks source link

【每日一题】- 2020-04-19 - !!~A.indexOf(edge._label) 是什么意思? #157

Closed azl397985856 closed 3 years ago

azl397985856 commented 3 years ago

该题目由 qq 群友贡献。

PS: 如上代码截取自某开源库。

Gentlemancj commented 3 years ago

-1 取反为0,其他取反均不为0,因此只有返回-1为0,即不存在这个元素。!!转为boolean

azl397985856 commented 3 years ago

@Gentlemancj 正解

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.