The Smartest Way to Search Arrays in JavaScript

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024
  • In today's video, we have a look at different ways to search arrays in JavaScript - things such as includes(), find() and findIndex() can be used to do this 😎
    For your reference, check this out:
    developer.mozi...
    🏫 My Udemy Courses - www.udemy.com/...
    🎨 Download my VS Code theme - marketplace.vi...
    💜 Join my Discord Server - / discord
    🐦 Find me on Twitter - / dcodeyt
    💸 Support me on Patreon - / dcode
    📰 Follow me on DEV Community - dev.to/dcodeyt
    📹 Join this channel to get access to perks - / @dcode-software
    If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!
    #dcode #javascript

Комментарии • 7

  • @Sayvai
    @Sayvai 11 месяцев назад

    Great video 😎 Already personally familiar with all those approaches.
    There is also an alternate version of searching an array and returning a boolean to indicate whether an even number exists in this example, using the Array.prototype.some() function.
    The Array.prototype.some() function will traverse through the array until the expression evaluates to find a match and returns true, or false if the expression doesn't ever evaluate / match, thereby returning false. Powerful, yet can be performant, as it can break out of an array iteration on first match, without traversing through the whole array.
    See an example snippet below:
    ```
    const numbers = [5, 9, 2, 4, 3];
    const containsEvenNumber = numbers.some(n => n % 2 === 0);
    console.log(containsEvenNumber); // true
    ```

  • @UsernameUsername0000
    @UsernameUsername0000 11 месяцев назад

    Great video. Array.prototype.some would’ve been perfect to introduce after the Array.prototype.find example, since it is similar but returns the Boolean like wanted.

  • @lounes03b99
    @lounes03b99 11 месяцев назад

    hi! i finished js course since days ago... I don't know what should do to practice?
    Solve some Problems In Problem Solving Websites Or start directly build project with HTML, CSS and JS?
    would you please make a video show how to build a begginer/intermediate website and landing page 🙏 🙏 with Front-End Basics🙏 🙏
    Thank You ♥ ♥

  • @raphaeljaggerd3585
    @raphaeljaggerd3585 11 месяцев назад

    So many ways to skin the poverbial cat. Thanks for the great content. By any chance are you willing to do tutorials on making packages

  • @farazk9729
    @farazk9729 11 месяцев назад

    Hi Domenic,
    Thanks for your very helpful videos; I am going through them one by one. I was wondering if you also have videos on React. I did a quick search, but I didn't find any.
    Thanks,
    Faraz

  • @lounes03b99
    @lounes03b99 11 месяцев назад

    You're gorgeous 🔥 I liks Your Videos 📹 Keep going🏃