indexOf and lastIndexOf methods | String Object In JavaScript

Sdílet
Vložit
  • čas přidán 26. 07. 2024
  • 🎁 Join my channel to get access to perks:
    / @codeexplained
    🧡 Hello All JavaScript Lovers Outhere!
    Today you're going to learn about the String Object In JavaScript.
    This tutorial is a series of videos, in each video we will discuss a method (or more) of the String Object in JavaScript.
    In today's video, you're going to learn about two string methods, indexOf and lastIndexOf, and know the difference between them.
    indexOf is used to get the index of the first occurrence of a searched string in a given string, and lastIndexOf is used to get the index of the last occurrence of the searched string.
    Example :
    const str = "The code is not working, the code is buggy.";
    console.log(str.indexOf("code")); // logs : 4
    console.log(str.lastIndexOf("code")); // logs : 30
    Both indexOf and lastIndexOf take in a second parameter called position, and it's simply the index you want to start the search for your "search string".
    🌍 Social Media Links.
    ◾ Facebook : / code.explained.official
    ◾ Twitter : / code_explained
    ◾ Instagram : / code.explained.official
    ◾ GitHub : github.com/CodeExplainedRepo
    💲 Suppport the Channel
    Paypal : paypal.me/CodeExplained
    Buy Me a Coffee: www.buymeacoffee.com/CodeExpl...

Komentáře • 23

  • @M.Maria.
    @M.Maria. Před rokem +1

    thank you very much, please continue making such videos

  • @bencielcabutin6815
    @bencielcabutin6815 Před 10 měsíci +1

    Bro! your effort in making this video and visualizations is A++.Thank you so much!

  • @codingtime3803
    @codingtime3803 Před rokem +1

    Thankyou so much. You have explained it very well

  • @reitei1756
    @reitei1756 Před rokem

    thank you so much for making this series, very helpful

  • @user-ce3bb8qc1k
    @user-ce3bb8qc1k Před rokem

    Thank you very much. Your explanations is so precisful and understandable.

  • @natashalesyk5764
    @natashalesyk5764 Před 3 měsíci

    Thank you!!!

  • @romelmahmud9507
    @romelmahmud9507 Před 2 lety

    Love the way you Teach. Love from Bangladesh 🇧🇩

  • @kumuthusandeepa8045
    @kumuthusandeepa8045 Před rokem

    Thanks ,IT is very helpful and superb explanation

  • @volodymyrpivtoranis6648

    Thank you! Great job 👏🏼

  • @fizaabid28
    @fizaabid28 Před 5 měsíci

    excellent

  • @ChicoWebDev
    @ChicoWebDev Před rokem

    thank you so much

  • @andiamakaza24
    @andiamakaza24 Před 2 lety +2

    It's 1:41am in India 😴😴

  • @MuhammadAdnan2.0
    @MuhammadAdnan2.0 Před 2 lety

    Please do more, great explained....

  • @abahiduh3246
    @abahiduh3246 Před 2 lety +1

    THANK U GREAT MAN, You have GREAT GREAT TUTORIALS. MY WISH is that u could pick a practical e.g CRUD IN JS and explain the logic. or explain the common JS logic. Thanks again

    • @CodeExplained
      @CodeExplained  Před 2 lety +1

      You're welcome.
      thanks for your suggestion.
      So when you said CRUD do you mean any particular database?

    • @abahiduh3246
      @abahiduh3246 Před 2 lety

      @@CodeExplained it could use nodejs with vanilla JavaScript or just like the TODO LIST you did but you explain the logic of CREATE, READ, UPDATE and DELETE. how the logic interact with the DOM (form) and events. Thank u very much again

    • @abahiduh3246
      @abahiduh3246 Před 2 lety

      @@CodeExplained here a link czcams.com/video/fL9cts8ykbUo/video.htmlf example BUT YOUR EXPLANATION IS THE BEST ON JS IN CZcams; I have subscribed to many channels. ONLY YOUR CHANNEL EXPLAIN THE JS LOGIC.
      if u can EXPLAIN the
      1. CREATE, how the code is submitted in the forms, display list and what happens in the console.
      2.READ, the LOGIC of how the code also displays items from local storage etc... no on PLAINS these METHOD: getItems(), parse() etc
      THE MAJOR confusion is to understand how the DOM affects the CONSOLE

  • @stephen1569
    @stephen1569 Před rokem

    Sounds to me like empty string is philosophically like the human soul.
    From StackOverflow…
    The empty string is everywhere, and nowhere. It is within all strings at all times, permeating the essence of their being, yet as you seek it you shall never catch a glimpse.
    Indeed, the empty string can be found between any two adjacent characters in a string as well as at the start and end. The first such instance is the very start of the string, namely position 0. All characters are separated by an empty String.
    A string contains the empty string in order to be in accordance with Set Theory, according to which:
    The empty set is a subset of every set including itself.
    This also means that even the empty string contains the empty string.