.some(), .every(), .find() and [...SPREADS] - Array Cardio Day 2 -

Поділитися
Вставка
  • Опубліковано 8 вер 2024
  • Day 2 of Array Cardio. Grab all the videos and starter files over at JavaScript30.com

КОМЕНТАРІ • 105

  • @justalonelypoteto
    @justalonelypoteto 8 місяців тому +39

    Refreshing to see more Odin comments, they were really fizzling out in the last few links. Remember y'all, this is the last of the lessons for the first part, if you survived this far you 100% got this :)

  • @MikeSealey_nhhc
    @MikeSealey_nhhc Рік тому +94

    The enthusiasm you have for coding is inspiring.
    I'm here from The Odin Project, and I keep referring back to these videos like a textbook. You're doing some really valuable work here!

    • @adamnasra3898
      @adamnasra3898 3 місяці тому +2

      Hello fellow Odinite!! TOP sent me here too.
      Since your comment is 1 year old I'm quite curious about the stage you must've reached today.
      Did you finish the entire course? If yes, did you land a job of some sort?
      was it a good trip so far?

  • @ThePolaris87
    @ThePolaris87 7 років тому +92

    I appreciate how you show the different ways to format a code from most basic to then write it again in a more advanced/more compressed format.

    • @painted_crimson
      @painted_crimson 4 роки тому +10

      I appreciate this as well. The only thing is I prefer writing it out more as I think it is so much more readable. I wonder what the standard would be at most companies and if that would be looked down upon.

  • @UNKNWN96
    @UNKNWN96 Рік тому +18

    TOP brought me here, thank you so much for these exercises. You don't waste time and you give great explanations on your projects!

    • @LagrangePoint0
      @LagrangePoint0 5 місяців тому

      So, where did you end up?, I've been trying to learn to code since november but still don't have enough confidence or knowledge to land on a dev job.

  • @thenextkawhileonard2585
    @thenextkawhileonard2585 3 роки тому +31

    .some() 0:21
    .every() 2:35
    .find() 3:01
    .findIndex() 4:40

  • @NCJHE
    @NCJHE 3 роки тому +5

    I'm currently a ball of stress prepping for a bootcamp interview and I just wanna say that WOAH...WOAAAAAHHH gave me my first laugh in literal days. Thank you, I needed that lmao

  • @mikesalcedo5321
    @mikesalcedo5321 Рік тому +8

    Awesome video! Currently doing the Odin Project and your explanations are incredibly good.

  • @ahmadaziz1800
    @ahmadaziz1800 6 років тому +26

    WOOW WHOAAAAOOOOO

  • @connorskudlarek8598
    @connorskudlarek8598 Рік тому +7

    Great video!
    However for new programmers: at 2:30, I think someone being a "hot shot" isn't necessarily a good thing. It's important to write code such that it is "self-documenting". By getting rid of the "currentYear" variable, it makes it less clear what you're actually getting from that "new Date()" constructor.
    The arrow function prior to that is probably the best iteration of this function just because it declutters. However, an "if" block is also totally acceptable if you feel that is more readable.

    • @zito3162
      @zito3162 2 місяці тому

      If you can make it work its worth!

  • @DragonWhisky
    @DragonWhisky 2 роки тому +1

    Hi Wes Bos, another day, another cardio. I am really enjoying practicing with you.

  • @clublati
    @clublati 6 років тому +2

    This JS 30 day challenge is a great idea! fun way of practicing. Thanks for this Wes!

  • @idktbh.2421
    @idktbh.2421 Рік тому +1

    4:10 that part made me laugh so hard it was so unexpected 🤣

  • @shubham09901
    @shubham09901 2 роки тому +3

    I was about to fall asleep and you go 04:10😂😂😂

  • @amgdeg4897
    @amgdeg4897 2 роки тому +3

    WO , WOOOOO

  • @01107345
    @01107345 3 роки тому +5

    .some(): 0:20
    .every(): 2:32
    .find(): 3:01
    .findIndex(): 4:39

  • @meloviiii
    @meloviiii 2 місяці тому

    I don't know why 4:05 made me laugh, I love it 😭

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

    These are just an awesome set of tutorial videos!! I think I should have started with the ES6 tuts first but that is next on the list! Thanks Wes

  • @re.liable
    @re.liable 2 роки тому +2

    I think the `.filter()` approach is an equally preferable approach for the last item. It's kind of a missed opportunity too, to discuss the other parameters of the callback functions for `.map()`, `.filter()`, and `.reduce()`
    I initially went with `delete comments[idx]` approach which, while it mutates the original array, does not update its length, and Google searches points me to using `.splice()` instead (as you have done here)

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

    Listening to the intro with beats on trips me up every time 😭

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

    You are funny man!😂 Thanks for the video

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

    Opening Music is as awesome as is your style of teaching.

  • @louisdyrhauge2897
    @louisdyrhauge2897 10 місяців тому

    Found this super helpful - thanks!

  • @OTRYHARDD
    @OTRYHARDD 8 місяців тому +1

    The Odin projects.

    • @LagrangePoint0
      @LagrangePoint0 5 місяців тому +1

      With the last one is simpler if you use filter()

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

    Nice! No need to create this functions myself anymore! BTW, the console.tab's just awesome, thanks!

  • @ShaunakHub
    @ShaunakHub 2 роки тому +1

    Just had a small query, is there any major disadvantages of using let instead of const - i.e. declaring variables instead of constants?
    I have so far seen most tutorials (if not all) have a preference for constants.
    But due to my very limited experience in coding & (bad) habits, I find myself using variables so that I can reuse the same without having to reinvent a new constant name.
    What I wanted to say is, say in a function I need to use 5 DOM objects at five different times (will never be reused once done with it) - I find it much easier to use a single variable and keep assigning it with a new object as and when needed.
    Any help in this direction will be much appreciated. Don't want to develop a bad habit early on :-) .

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

    Woahhh woaahhh! Ahahaha

  • @re.liable
    @re.liable 2 роки тому

    4:10 cracked me up I'm sorry LMAO

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

    Did you know that you can use all these methods for the same thing?
    Or else, you can use forEach to do pretty much everything covered in this video 😀

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

    thank you so much mate!

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

    you really helpme with this video, Thanks!

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

      You’re welcome!

  • @wepranaga
    @wepranaga 5 років тому +3

    feeling like total hotshot.
    woah

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

    amazing tutorials!

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

    Why spread slice over using the filter method? Just curious

  • @adamnasra3898
    @adamnasra3898 3 місяці тому

    I really like how nimble you are with your lines of code. how did you manage to move a line of code from on line to another? I'm referring to the edit made @1:46

    • @OscarLeonardo115
      @OscarLeonardo115 3 місяці тому +1

      Just press alt (option on mac) + up or down

  • @user-pj9xf8mf1h
    @user-pj9xf8mf1h Рік тому

    What is the most sound way to get a table of people's name and year for individuals who are over the age of 19? Is there a way to use .every() method to get this table?

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

    why did you wrap new date in parenthesis?

  • @emmanuel4699
    @emmanuel4699 7 років тому +4

    so nobody is going to ask what song is playing at the beginning?

  • @user-xz8of6pk8q
    @user-xz8of6pk8q Рік тому

    thank!!

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

    thank you for this videos, and... what is the name of the intro song

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

    Hey, thanks for all the good work, it's nice to have someone introduce new ES6 features in such a practical fashion :).
    Q: Is there a reason not to use .splice(), and do the expansion method? The code ends up looking more verbose and less readable...

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

      AlexUA-cam Splices modifies the original array and return the deleted one. That is why he uses slice :)

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

      If you want to keep the original array intact, but prefer using the splice() method, you can simply do the following:
      const newComments = [...comments];
      newComments.splice(index, 1);
      This ensures that the changes are immutable and is a bit easier to read in my opinion.
      PS. Just in case you were wondering, you cannot simply do the splice on the same line (eg. const newComments = [...comments].splice(index, 1);) because splice() will actually return the "removed" item(s) as a new array.

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

    Yo you are so funny

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

    Late to the party! These are really awesome, Wes! Actually commenting for Array Cardio 1, #6. I've typed in your sample code as is but I can't seem to get past an error: null is not an object for category.querySelectorAll.

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

    Great stuff, I learned :)

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

      Did you do part 1?

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

      @@nicholasberube5957 Yep :)

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

      Did you try his solution for exercise 6 in the console? You can look at my comment on day 1 video for reference. I had to declare another variable to make it work.

  • @antontraceur
    @antontraceur 6 років тому

    Hey man, thank you for your tutorials they are awesome. Can you say me what editor you’re using and the theme with the font please 🙏

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

      I am pretty sure the font is called Hack

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

    what are you using for autocompletion? nice video!

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

    how does he visually copy and paste by moving the cursor in 1:46?
    and is there a name to that specific feature on IDEs or text editors?

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

      On VSCODE (Mac) hold 'option' and move with arrow keys up or down

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

      Awesome! Although I use neovim, I made it work with some remap. Thank you :)

  •  5 років тому

    Array.prototype methods are nice, but I prefer to use for and while loops, because I'm old and used to these.
    Besides, the performance of Array.prototype methods is atrocious on large data sets, across all browsers, while loops perform quite well.

  • @danbuild977
    @danbuild977 6 років тому

    Hi Team, Can someone kindly explain why I cant just have this slice in my code instead: ...comments.slice(0, 2),
    It works exactly the same. Is there a reason you have put in the second slice rule?
    "...comments.slice(index + 1)"

    • @VivekGawande1
      @VivekGawande1 6 років тому

      The second part is for the elements that come after that element we are deleting

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

    2:51// in 2034 lux will be 19,, and because of Date() method, allAdults variable's value will be true 😄

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

    Could someone give me a dummy explanation of how the two splice instructions work?
    My brain is fried!

    • @vitfl2580
      @vitfl2580 5 років тому +2

      In this video there is two slice, not two splice. The first slice is creating array of elements before the element that we want to delete , and the second slice is doing the same with elements that go after the element we want to delete. And those two arrays are spread inside newComments array.

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

      slice(0,5) cuts the array from the index 0 to index 4 ( second parameter in excluded)

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

      ​@@vitfl2580 ​ Thank you, my brain is a little less fried now.

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

      ​@@salthesadmanshark5645 Thanks Sal, much appreciated.

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

    WOW. WOW.

  • @CemilArancak
    @CemilArancak 6 років тому

    hi do you have your training set in udemy

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

    UH HOTSHOT

  • @hellonihaocomoestas
    @hellonihaocomoestas Рік тому +1

    i like this but iwi sh there more emphasis on teaching. i feel like he's just speeding through solving the problems instead. For someone that just needs a refresher this may be great but for someone that is learning the concepts its a bit hard to follow.

    • @WesBos
      @WesBos  Рік тому +1

      Check out my beginnerjavascript.com course. These videos are more focused on practice where the course is learning

  • @anonim1468
    @anonim1468 6 років тому

    why we can't just - delete comments[index] is something wrong with this?

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

      oh I understood...

  • @Human_Evolution-
    @Human_Evolution- 3 роки тому

    How do I get those comments in that awesome font?

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

      change comments style in settings.json in vscode

    • @Human_Evolution-
      @Human_Evolution- 3 роки тому +2

      @@aashiqahmed5273 more specific please.

  • @user-gi1bm4fm8e
    @user-gi1bm4fm8e Рік тому

    4:06
    😂

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

    why so many parenthesis? :(

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

    Nice tutorial! What about JavaScript practice with real projects?

    • @WesBos
      @WesBos  7 років тому +21

      That is what the other 28 videos are on JavaScript30.com

    • @ezra3457
      @ezra3457 6 років тому +4

      Lol

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

      @@WesBos lmao

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

    Honestly dude, great content but you go way too quickly in all your videos and it really diminishes the experience.
    I get it, we can pause and what not but if it's still too fast 0.75 speed, then you're going to fast.

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

    splice

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

    it is annoying for beiginners

  • @danielvelkov116
    @danielvelkov116 11 днів тому

    this console.table method changed my life