Beautiful! findIndex() is super powerful.
💛 JavaScript tip 💛 indexOf uses strict equality comparison under the hood. This means it can only ever find the exact reference but not an identical object. 'findIndex' fixes this because you can pass a callback you can use to identify an object. ↓
1
31
123
17
0
3
14
123
16
0
Another powerful use of findIndex(): const a = [2, 8, 73 /*,…*/]; const s = 55; if (1 + findIndex(x=>x==s)) { console.log("a contains s"); };
0
0
9
0
28
1st Dr.V.Chandrasekar BCA., MCA., Mphil/ Phd Computer Sciences ., Pursuing., Computer Subject:Java and Javascript Program . (100/100).Programmer., Software Engineer. Cell number:9360949895. E-mail:[email protected] 🙂 Freelaunzer 🇮🇳🥘🍲.
0
0
0
0
2
United States 趨勢
- 1. The JUP 138K posts
- 2. The PENGU 137K posts
- 3. Good Monday 25.1K posts
- 4. Lorraine 10.1K posts
- 5. #oasis 1,794 posts
- 6. #MondayMotivation 24.2K posts
- 7. #smoothie 1,518 posts
- 8. Ravens 65.8K posts
- 9. #syntax 1,467 posts
- 10. #dash 1,659 posts
- 11. 60 Minutes 74.5K posts
- 12. Victory Monday N/A
- 13. Bari Weiss 62.9K posts
- 14. Patriots 129K posts
- 15. Greenland 7,359 posts
- 16. Drake Maye 28.5K posts
- 17. Lamar 28.8K posts
- 18. Harbaugh 12.1K posts
- 19. Henry 61.5K posts
- 20. TOP CALL 8,439 posts
Loading...
Something went wrong.
Something went wrong.