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 Trends
- 1. Tulane 24.6K posts
- 2. Eagles 73.9K posts
- 3. Oregon 23.6K posts
- 4. Ben Johnson 2,736 posts
- 5. Josh Johnson 3,614 posts
- 6. Jake Elliot 3,672 posts
- 7. Andrew Tate 36.9K posts
- 8. NFC East 13.7K posts
- 9. #GoPackGo 3,636 posts
- 10. Saquon 8,380 posts
- 11. #Bears 3,758 posts
- 12. Group of 5 7,576 posts
- 13. Dante Moore 1,206 posts
- 14. Steen 4,242 posts
- 15. Jordan Davis 1,339 posts
- 16. Ringo 15.9K posts
- 17. Notre Dame 36.2K posts
- 18. Dan Quinn N/A
- 19. #GBvsCHI N/A
- 20. Texas 172K posts
Loading...
Something went wrong.
Something went wrong.