JavaScript Tip: Using Data Attributes

Поділитися
Вставка
  • Опубліковано 29 січ 2025

КОМЕНТАРІ • 42

  • @davorperic3577
    @davorperic3577 4 роки тому +4

    Great explanation, thank you sir :)

  • @niloofar9113
    @niloofar9113 3 роки тому +1

    I finally understand thanks to you thank you🙌

  • @nixonnelson8856
    @nixonnelson8856 6 років тому +9

    Sir you are great . But had a doubt , U converted Node list into array but you didnt use forEach on the new array still it worked ??

    • @AllThingsJavaScript
      @AllThingsJavaScript  6 років тому +8

      I rewatched that portion of the tutorial and you are correct. That is a mistake. I used the wrong variable. It looks like forEach will function on a nodeList, which I was not aware of, but I believe other Array methods will not. Sorry about the confusion.

    • @usmanabdurehman97
      @usmanabdurehman97 5 років тому +4

      Nodelist,HTML collection and normal array etc are iterable using any loop may it be for, while or the forEach method

  • @jessicaryan9820
    @jessicaryan9820 3 роки тому +1

    Brilliant, thank you! This is going to make web animation a lot easier

  • @joshrandall3663
    @joshrandall3663 4 роки тому +1

    Clear explanation!

  • @gbbowler
    @gbbowler 4 роки тому +2

    Curious about first couple of lines in your JS file. They are:
    let lis = document.querySelectorAll('li');
    let lis_array = Array.from(lis);
    You never use the variable lis_array anywhere in your code after that, so why did you define it? I"m working on something now using the data- attribute. I left that second variable out of my code, and it works just fine.
    BTW, I love your vids. I'm also taking one of your courses on Udemy.

    • @AllThingsJavaScript
      @AllThingsJavaScript  4 роки тому +3

      Great question. I think I just forgot to use it. Basically that line is converting the list of elements to an array. This would be very helpful if you needed to use array methods, so it is a common practice for me. However, many things work on the array-like collection like forEach, so it was unnecessary.

  • @mickwhyte4204
    @mickwhyte4204 4 роки тому +2

    Always very helpful. Many thanks.

  • @liyan542
    @liyan542 6 років тому +5

    Great tutorial! The forEach() should use lis_array instead of lis. Array.prototype.forEach() can only apply to arrays, not array-like objects.

    • @AllThingsJavaScript
      @AllThingsJavaScript  6 років тому +1

      You are correct. I converted to an array and then used the wrong variable.

  • @phanindrakumarpulletikurti
    @phanindrakumarpulletikurti 7 років тому +2

    awesome lecture.

  • @MultiNAME69
    @MultiNAME69 2 роки тому

    Thank you very much.

  • @akira557
    @akira557 6 років тому +5

    thank you!

  • @NedumEze
    @NedumEze 3 роки тому

    Thank you sir. So helpful. I must be doing something wrong. Can't get my own code to work. Could I share it with you? Maybe, you'd spot my mistakes. Please.

    • @AllThingsJavaScript
      @AllThingsJavaScript  3 роки тому +1

      Sure, post it here.

    • @NedumEze
      @NedumEze 3 роки тому

      @@AllThingsJavaScript
      Ah! Bless you sir. I've got sorted now. Thrilling to see it working.
      Thank you so much for offering to help sir. I hope I can reach out to you if I run into any more brick walls?

  • @jainshilpi3
    @jainshilpi3 7 років тому

    Could you pls make video for call bind apply methods?

  • @somashekarbagurthippeshapp2389
    @somashekarbagurthippeshapp2389 3 роки тому

    Thank you sir

  • @jainshilpi3
    @jainshilpi3 7 років тому

    Can u please make some video related with javascript datastructure?

    • @AllThingsJavaScript
      @AllThingsJavaScript  7 років тому

      Can you explain what you are referring to for javascript datastructure videos?

    • @jainshilpi3
      @jainshilpi3 7 років тому

      data structures like queues an stacks, etc using objects and arrays?

    • @AllThingsJavaScript
      @AllThingsJavaScript  7 років тому

      I have a number of tutorials on both objects and arrays. I have a specific playlist on objects and there are numerous other tutorials on both objects and array.

    • @jainshilpi3
      @jainshilpi3 7 років тому

      means topic relater with linked list stack queue?

    • @ironhide9955
      @ironhide9955 4 роки тому

      @@jainshilpi3 could you please share me the links if you have found some useful videos related to javascript datastructure?

  • @rogerh2694
    @rogerh2694 6 років тому +3

    You used the forEach() method on the node list (lis) not the array (lis_array) but your event listeners still worked...?? Update: still works on the node list lol

    • @AllThingsJavaScript
      @AllThingsJavaScript  6 років тому +3

      forEach will work on any iterator. A node list is one, so that is why it still worked.

    • @NixTheG0at
      @NixTheG0at 5 років тому

      For NodeList , forEach works, but for HtmlCollection doesnt

  • @YoungmeePark1103
    @YoungmeePark1103 4 роки тому

    Super!!

  • @muhammadsafiullah8428
    @muhammadsafiullah8428 5 років тому

    Thanks!

  • @seenuvasanv
    @seenuvasanv 7 років тому

    Thanks

  • @BryanDevsCoding
    @BryanDevsCoding Рік тому

    Still good video this 2024

  • @adicide9070
    @adicide9070 4 роки тому +1

    a bit faster, though, would be greeeeaaaat. cheers.

    • @rayna.v
      @rayna.v 4 роки тому +1

      change the playback speed.

  • @RameenFallschirmjager
    @RameenFallschirmjager 5 років тому

    The other day I heard from a c++ coder that web coders are not programmers, or not even developers! Because he asserted web doesn't have logic and algorithms have nothing to do with web! I don't know under which rock he was all these years or in which cave he was been hiding! Anyway, I hope he sees this channel, and comes out of his grave delusion. And choose a photo for channel icon or whatever it is for god sake! It looks darn bad like this!

    • @AllThingsJavaScript
      @AllThingsJavaScript  5 років тому

      I think most people have been corrected of that misperception, but I guess there are still some out there. Google keeps wiping my channel photo. It is a bit frustrating. Not sure what is going on.

    • @RameenFallschirmjager
      @RameenFallschirmjager 5 років тому

      @@AllThingsJavaScript Thanks for answering me. The removal of your channel photo might be due to copy right infringement. Just put some original photo which you've made it yourself. For example your beautiful face! You have a beautiful voice and because you're contributing to humanity a great deal your soul must be beautiful too. So I'm sure your face is beautiful! Then putting your own face for the icon of your channel is a good option bro!

    • @AllThingsJavaScript
      @AllThingsJavaScript  5 років тому

      Thanks for the suggestion. I don't know how beautiful my face is, but that was the picture I've had up and have tried to load multiple times again. I'm not sure what is going on, but still trying to figure it out.

    • @RameenFallschirmjager
      @RameenFallschirmjager 5 років тому +1

      @@AllThingsJavaScript So maybe you're too good looking that it raises powerful people jealousy, so they remove your picture! Like snow white and seven dwarfs and that darn magic mirror and that nasty queen who couldn't bear someone more beautiful than her!😂 Take care of yourself bro!