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

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 พ.ย. 2024

ความคิดเห็น • 110

  • @MikeSealey_nhhc
    @MikeSealey_nhhc 2 ปีที่แล้ว +103

    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 6 หลายเดือนก่อน +4

      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?

    • @abdelhakimhamidi-zv4qs
      @abdelhakimhamidi-zv4qs หลายเดือนก่อน

      @@adamnasra3898 how are you doing,did you go react or ruby on rail

  • @ThePolaris87
    @ThePolaris87 7 ปีที่แล้ว +97

    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.

  • @justalonelypoteto
    @justalonelypoteto 10 หลายเดือนก่อน +52

    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 :)

    • @albertt755
      @albertt755 2 หลายเดือนก่อน +4

      I come from Odin bro!
      Thanks for saying "that if you survived this far you 100% got this."
      Array methods seems difficult to understand but I hope in time I will understand it.

    • @Thats_Handle0
      @Thats_Handle0 หลายเดือนก่อน

      @@albertt755 fr

  • @UNKNWN96
    @UNKNWN96 2 ปีที่แล้ว +22

    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 8 หลายเดือนก่อน +1

      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.

    • @albertt755
      @albertt755 2 หลายเดือนก่อน

      Me too!

  • @thenextkawhileonard2585
    @thenextkawhileonard2585 3 ปีที่แล้ว +32

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

  • @mikesalcedo5321
    @mikesalcedo5321 ปีที่แล้ว +8

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

  • @NCJHE
    @NCJHE 3 ปีที่แล้ว +6

    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

  • @DragonWhisky
    @DragonWhisky 3 ปีที่แล้ว +1

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

  • @clublati
    @clublati 7 ปีที่แล้ว +2

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

  • @connorskudlarek8598
    @connorskudlarek8598 2 ปีที่แล้ว +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 5 หลายเดือนก่อน

      If you can make it work its worth!

  • @01107345
    @01107345 3 ปีที่แล้ว +5

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

  • @ahmadaziz1800
    @ahmadaziz1800 6 ปีที่แล้ว +26

    WOOW WHOAAAAOOOOO

    • @thomasblancbolelli
      @thomasblancbolelli 4 ปีที่แล้ว +4

      Was deadass laughing so hard that I choked on my water haha

    • @loudrockacdc
      @loudrockacdc 3 ปีที่แล้ว +1

      right

  • @davidolona7365
    @davidolona7365 ปีที่แล้ว

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

  • @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)

  • @DannyFunny123
    @DannyFunny123 6 ปีที่แล้ว +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

  • @sidarjunful
    @sidarjunful 4 ปีที่แล้ว

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

  • @shubham09901
    @shubham09901 2 ปีที่แล้ว +3

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

  • @kimuelanqui467
    @kimuelanqui467 2 ปีที่แล้ว

    You are funny man!😂 Thanks for the video

  • @amgdeg4897
    @amgdeg4897 2 ปีที่แล้ว +3

    WO , WOOOOO

  • @idktbh.2421
    @idktbh.2421 ปีที่แล้ว +1

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

  • @louisdyrhauge2897
    @louisdyrhauge2897 ปีที่แล้ว

    Found this super helpful - thanks!

  • @meloviiii
    @meloviiii 4 หลายเดือนก่อน

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

  • @math2001
    @math2001 7 ปีที่แล้ว

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

  • @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 😀

  • @ShaunakHub
    @ShaunakHub 3 ปีที่แล้ว +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 :-) .

  • @CacheMoney-f7x
    @CacheMoney-f7x ปีที่แล้ว

    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?

  • @juliosamaniego6585
    @juliosamaniego6585 2 ปีที่แล้ว

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

  • @josedanielrodriguez3348
    @josedanielrodriguez3348 2 ปีที่แล้ว

    you really helpme with this video, Thanks!

    • @WesBos
      @WesBos  2 ปีที่แล้ว

      You’re welcome!

  • @3deste233
    @3deste233 4 ปีที่แล้ว +1

    Why spread slice over using the filter method? Just curious

  • @emmanuel4699
    @emmanuel4699 7 ปีที่แล้ว +4

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

    • @kissu_io
      @kissu_io 7 ปีที่แล้ว +1

      is it yours ? xD

    • @PerryPalmtree
      @PerryPalmtree 6 ปีที่แล้ว +4

      darude sandstorm

  • @adamnasra3898
    @adamnasra3898 6 หลายเดือนก่อน

    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 5 หลายเดือนก่อน +1

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

  • @OTRYHARDD
    @OTRYHARDD 10 หลายเดือนก่อน +1

    The Odin projects.

    • @LagrangePoint0
      @LagrangePoint0 8 หลายเดือนก่อน +1

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

  • @bedribulut
    @bedribulut ปีที่แล้ว

    thank you so much mate!

  • @tramarthomas6105
    @tramarthomas6105 3 ปีที่แล้ว

    amazing tutorials!

  • @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.

  • @TheLeonKwameShow
    @TheLeonKwameShow 5 ปีที่แล้ว +1

    why did you wrap new date in parenthesis?

  • @anstapol
    @anstapol 7 ปีที่แล้ว

    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 🙏

  • @kira_codm1482
    @kira_codm1482 หลายเดือนก่อน

    TOP comrades! Lets goooooooo

  • @alex_questionmarks
    @alex_questionmarks 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 ปีที่แล้ว

      AlexTH-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.

  • @jannmarcvillablanca7183
    @jannmarcvillablanca7183 2 ปีที่แล้ว

    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 :)

  • @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

  • @facundoflores9640
    @facundoflores9640 7 ปีที่แล้ว

    what are you using for autocompletion? nice video!

  • @wepranaga
    @wepranaga 5 ปีที่แล้ว +3

    feeling like total hotshot.
    woah

  • @anonim1468
    @anonim1468 6 ปีที่แล้ว

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

    • @anonim1468
      @anonim1468 6 ปีที่แล้ว +1

      oh I understood...

  • @re.liable
    @re.liable 2 ปีที่แล้ว

    4:10 cracked me up I'm sorry LMAO

  • @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.

  • @deveren
    @deveren 2 ปีที่แล้ว

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

  • @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.

  •  6 ปีที่แล้ว

    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.

    • @Admlass
      @Admlass 2 ปีที่แล้ว

      Ok boomer

  • @herentran
    @herentran ปีที่แล้ว

    thank!!

  • @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.

  • @CemilArancak
    @CemilArancak 6 ปีที่แล้ว

    hi do you have your training set in udemy

  • @shrangisoni8758
    @shrangisoni8758 6 ปีที่แล้ว +5

    Woahhh woaahhh! Ahahaha

  • @gustav0santos
    @gustav0santos 2 ปีที่แล้ว

    WOW. WOW.

  • @eotikurac
    @eotikurac 5 ปีที่แล้ว

    why so many parenthesis? :(

  • @hellonihaocomoestas
    @hellonihaocomoestas 2 ปีที่แล้ว +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  2 ปีที่แล้ว +1

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

  • @samt7755
    @samt7755 3 ปีที่แล้ว +1

    Yo you are so funny

  • @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

  • @MrGinp
    @MrGinp 4 ปีที่แล้ว +1

    UH HOTSHOT

  • @헛소리하지마임마-g4y
    @헛소리하지마임마-g4y ปีที่แล้ว

    4:06
    😂

  • @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 2 หลายเดือนก่อน

    this console.table method changed my life

  • @AkshatOfficial-t3c
    @AkshatOfficial-t3c 12 วันที่ผ่านมา

    4:08 🤣🤣