Do YOU know these 7 JavaScript tricks?

Поделиться
HTML-код
  • Опубликовано: 23 ноя 2024

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

  • @brendonovich
    @brendonovich Год назад +19

    based

    • @JustSomeAussie1
      @JustSomeAussie1 Год назад +2

      cringe use of "based"

    • @brendonovich
      @brendonovich Год назад +2

      @@JustSomeAussie1 were you here when the title was '7 based javascript tips'

  • @Woezinga
    @Woezinga 27 дней назад

    love your examples and quiet, relaxed way of talking

  • @shashydass4114
    @shashydass4114 Год назад +9

    This is a great video because it shows JS idioms that develop in teams that have to read and maintain code. So it emphasizes succinct code but not at the expense of readability. Its a great insight into how JS is done in real dev environment. Great job!

    • @mewtru
      @mewtru  Год назад +1

      Thank you for the kind words 🥹

  • @AR7editing
    @AR7editing Год назад +5

    I use un sort a and d
    a for ascendent and d for descendent

  • @DarkFlarePrince
    @DarkFlarePrince Год назад +3

    I've watched countless JS tricks videos and this is by far, the most impressive one. I actually didn't know you could double bang. Life changer! also the a-z!!!!!! WHAT!! Please do more!

    • @mewtru
      @mewtru  Год назад

      Haha thank you!!! Glad you liked it :)

  • @christineb8312
    @christineb8312 Год назад +1

    Tru! Still learning my way around JavaScript here and I found this pretty helpful. It helps that you kinda gave examples of where you would use the code. That's where I have the most trouble. Figuring out what to write to make certain things happen. Can't wait to see more of this kind of content. I'm sure it takes more time to create but this is pure gold! Thank you !

  • @defaultgn
    @defaultgn Год назад +3

    Using destructuring and the spread operator together blew my mind 🤯. It's very similar to an elixir pattern that I had never thought to replicate in js. Super cool!

  • @shibet196
    @shibet196 Год назад +3

    Loved the video, especially that sorting trick, I always get confused wether its ascending or descending 😂😂

  • @skitto6554
    @skitto6554 6 месяцев назад

    I love it! Thank you. quick tip, filter and map automatically skip undefined elements, eliminating the need for manual falsy checks.
    myName.filter(val=>val).join(' ') will produce the same results.

  • @veebxl
    @veebxl 10 месяцев назад

    So useful , of course this makes things much clearer .Thank you! 🌺

  • @chandnisoni3954
    @chandnisoni3954 Год назад +1

    This video was amazing.Thank you. Please keep coming more. Would love more content on Typescript.

    • @mewtru
      @mewtru  Год назад +3

      Thank you! Will do :) recording a “how to learn TypeScript as a JavaScript dev” type video

    • @loop99-y4u
      @loop99-y4u Год назад

      @@mewtru waiting

  • @saeem01670
    @saeem01670 Год назад +1

    Cool! Thanks for sharing!!!

  • @esportsgapshap3149
    @esportsgapshap3149 Год назад

    Thanks..didn’t know most of these and u explained well

  • @myabdi4
    @myabdi4 Год назад

    This is really useful. Thanks Tru!

  • @fabianaasara7745
    @fabianaasara7745 Год назад

    You are just the best!! Thank you so much ❤😊

  • @thainole
    @thainole Год назад +1

    Amazing tips!

  • @karthikk6769
    @karthikk6769 Год назад +2

    I get confused a lot with the sort order. Sort tip is a save

  • @imPrathamDev
    @imPrathamDev Год назад +1

    in the array destructuring example [...rest] its rest operator not spread operator

    • @IainSimmons
      @IainSimmons Год назад

      Came here to say the same.
      It's a bit confusing because the rest operator obviously looks the same but it almost doing the opposite, it's combining multiple values into one variable instead of spreading/separating one value into many.

  • @Asyncideas
    @Asyncideas Год назад

    You make great content! Thanks

  • @andyslack1167
    @andyslack1167 Год назад

    Really great content, well done!!

  • @linoalexanderpineda8350
    @linoalexanderpineda8350 Год назад

    Please make a video explaining promises with TS , Love your content keep it up 💪!

  • @medodahman9986
    @medodahman9986 Год назад

    i really love your coding tutorials and it's really helpful and funny way you are teaching, but what is the name of theme you are using?

  • @lih4553
    @lih4553 Год назад +1

    some method is hella useful

    • @mewtru
      @mewtru  Год назад

      SOMEwhat useful 👀

  • @ayushgogna9732
    @ayushgogna9732 Год назад

    Thanks Tru. great video

  • @Solsenderz
    @Solsenderz Год назад

    sort method with a- z is pretty helpful fr

  • @RILCOMusic
    @RILCOMusic Год назад

    I have an original Killer Instinct 2 arcade cabinet in my living room! Unite!

  • @myspace9030
    @myspace9030 Год назад +1

    Cool 😎

  • @AndrewTSq
    @AndrewTSq Год назад

    In my brain a - b and a - z means the same thing in sort :D and b - a and z - a, guess we all think different. I usually use spread operator and set, and ?? and ? a lot actually. ? is great when checking for objects exist or not, so you dont get an error. object?.name?..surename for example. destructering I use it alot also in vector cordinatex [x,y,z] . . Array.from I use alot to get my set back to an array after removing duplicates :) never thought about the {length} in array.from, that was nice to learn thanks.

  • @surendrareddyseelam9757
    @surendrareddyseelam9757 Год назад

    Thanks for sharing these dear

  • @TheHoinoel
    @TheHoinoel Год назад

    this is great, thank you :)

  • @gbh1998
    @gbh1998 Год назад

    What's the VSCode theme you are using?

  • @codewithguillaume
    @codewithguillaume Год назад

    Always a pleasure to see a video of you :)

  • @jongeduard
    @jongeduard Год назад

    Really great and useful video! But certain things really deserve some notes.
    First, the main reason that you really don't want to do deduplication that first way you showed at 3:47 is simply efficiency (you did not mention this).
    Running the indexOf function on the original array in literally every iteration is unnecessary expensive. This matters a lot for very large arrays.
    When doing such an action, you would really run that function on the shorter, deduplicated array that you are creating instead.
    Next. I find the a - z approach for sort actually also confusing, because it kind of hides what is actually going on, which is that the callback function is really only comparing just 2 values next to each other, but simply repeatedly in a loop.
    Therefore I would rather to choose names like prev, next instead.
    In general I also recommend not using single letter names for things in most cases, or any kind of abreviations.
    Not ind, but index (what does ind mean? index, individual or independend). And not rec, but record or receiver (used in another video).
    Etc.
    Last nitpick, when working 1 single argument in an arrow function, you can just leave the brackets around it away.

  • @farhanbegg9152
    @farhanbegg9152 Год назад

    Wow this is so awesome

  • @mayankk104
    @mayankk104 Месяц назад +1

    1:47 speaking of cleaner, please don't put "return" in filter function

  • @RILCOMusic
    @RILCOMusic Год назад

    Tru maybe you can help understand this probably simple concept.
    In the first example, you have const = filterMyName = myName.filter(name).....
    I have never understood where "name" gets declared or how JS knows what "name" is. Can anyone help me with this? Like, none of the things in the array or anywhere else are given the label "name", so how does this get initialized and passed in?
    Thank you, glad to see your channel growing!

    • @IainSimmons
      @IainSimmons Год назад

      It's a parameter for the callback function used in the filter method.
      A parameter is basically a temporary variable used only in the function, and can be called anything, not specifically "name".
      A callback is a function that gets "called" by the method it is used in, in this case, it is called for each item in the array, and it passes the item as the first argument, which is then accessed/assigned to the first parameter "name" (could be called anything).
      A method is a function available to a certain type of object. In this case, the Array object, so all arrays can use .filter

  • @ravenMK_
    @ravenMK_ Год назад

    Her: "Do you know that?"
    Me: *Pulls my note cuz I'm ready to know*
    Learned a lot. Especially when and when not to use ?? and ||. Tbh, I barely use ??.

  • @iammuttaqi
    @iammuttaqi Год назад

    I have a question...
    What techniques does Discord use to ensure that new features are consistent across all of its platforms, and how does it balance the need for platform-specific code with the goal of maintaining a common codebase for many of its features?

  • @martapfahl940
    @martapfahl940 Год назад

    Hey,. awesome tips! =) Do you know if the JavaScript Set keeps the original order of the items? The Set as a data structure, as far as I know, does not guarantee that it will output the original order.

  • @sherzodtoxirov9439
    @sherzodtoxirov9439 Год назад

    Why you don't open your coding course that dedicated js, typescript and react. I think it would be good idea. And I liked this content.

  • @oloja__
    @oloja__ Год назад +1

    bonkers🚀

  • @olagunjumoses2983
    @olagunjumoses2983 7 месяцев назад

    How did you learn JS. You so detailed

  • @kenqz2623
    @kenqz2623 Год назад +1

    what theme? Loved the video

    • @mewtru
      @mewtru  Год назад

      I use Moonlight!

  • @JaswantSingh-qj4xn
    @JaswantSingh-qj4xn Год назад +1

    I am React Developer and want to learn advanced concepts that you use while coding. What course I can follow?

  • @misterl8129
    @misterl8129 Год назад

    es increible como la voz de una mujer te permite concentrarte mejor por la sutileza y suavidad que transmite. Sueno como un simp asqueroso, pero es real jajajajajaja

  • @mohamedabdul633
    @mohamedabdul633 Год назад

    This is cool!

  • @FireGames25
    @FireGames25 Год назад +1

    BASED

  • @zahirshaikh3535
    @zahirshaikh3535 Год назад

    i really love you video keep it up buddy ........!!!!!!

  • @51Grimz
    @51Grimz Год назад

    Can you use the new Set() trick for not only a flat array of strings but one of objects even nested objects, where you guarantee that one property like "key" is unique? Would that still require a custom filter function on the array still?

    • @51Grimz
      @51Grimz Год назад

      I think I answered my own question but the docs have an iterable property to the Set constructor which I think could be used in this case. Pretty neat trick though!

    • @51Grimz
      @51Grimz Год назад

      To follow up again. Upon adding a new item to the set, I wonder how it could guarantee it's uniqueness via that same object property.

    • @AndrewTSq
      @AndrewTSq Год назад

      @@51Grimz I had the same problem a while back, but I copied someone else code that I found :-) function getUniqueListBy(arr, key) {
      return [...new Map(arr.map(item => [item[key], item])).values()]
      } so then you pass in the array with objects, as arr, and select which key you want to remove duplicates on.

  • @syednaqvi6572
    @syednaqvi6572 Год назад

    Loved it

  • @kirso
    @kirso Год назад

    You mentioned on Twitter that you were thinking of doing a video on how to start in webdev if you would do it today. Is it still coming? :)

    • @mewtru
      @mewtru  Год назад +3

      Yeah it’s been hard actually figuring out how I’d learn haha 😅 took me multiple years and a lot of resources most people don’t just have on hand

    • @kirso
      @kirso Год назад +1

      @@mewtru for sure, frankly there are tonnes of resources but people tend to be stuck in tutorial hell and a lot of resource quality is not really up to par saying things like: "This is state, its used for changing things."
      Frankly we have more resources than ever, but learning is probably as challenging as it used to be, particularly for shipping products, not just getting a job.

  • @duynd243
    @duynd243 Год назад

    Can you share your VSCode theme name?

  • @luisbauu
    @luisbauu Год назад +1

    based

  • @sourishdutta9600
    @sourishdutta9600 Год назад

    Can you make videos about react typescript libraries, and how to create reusable generic ones with type safe. These videos are great but so basics stuff, your design related videos and architecture discussions are more useful and interesting, anyways Thank you :)

    • @mewtru
      @mewtru  Год назад +1

      Yeah for sure! Got a little busy this last week so I had to do something quicker haha, but thanks for the idea!!

    • @sourishdutta9600
      @sourishdutta9600 Год назад

      @@mewtru Thanks to you, for sharing your knowledge. Take your time, really appreciate your hard work.

  • @Pyrospower
    @Pyrospower Год назад

    nice vieo, thank you for the tips!

  • @maheshpawaar
    @maheshpawaar Год назад +1

    Which font you're using?

  • @pratiksavaliya3890
    @pratiksavaliya3890 8 месяцев назад

    => { return !!name } sign you are psychopath 😂

  • @codecaine
    @codecaine 3 месяца назад

    👏👏👏

  • @TinkerWithEmmo
    @TinkerWithEmmo Год назад

    Nice 🤩

  • @rumoneanderson270
    @rumoneanderson270 Год назад

    What font do you use?

  • @badbounstv
    @badbounstv Год назад

    so niceeee

  • @JasonJA88
    @JasonJA88 Год назад

    👍🏿

  • @Shabztubeyou
    @Shabztubeyou Год назад

    i just got bAsEd

  • @igorr4682
    @igorr4682 6 месяцев назад +1

    Finally, someone who speaks proper English and can provide meaningful context.

  • @manindrasammanathegreat8253
    @manindrasammanathegreat8253 Год назад +1

    🤍🤍🤍

  • @emelyandtheuke
    @emelyandtheuke Год назад

    did you mean to say biased?

  • @AG-ur1lj
    @AG-ur1lj Год назад

    Please, please do not use the `Boolean` object.
    1. It creates an entire object in memory for no reason. Now, instead of a simple value of ‘true’ or ‘false’, you have an object storing true & false properties-and the names of those properties, and other metadata such as it’s own data type (`Object`), pointers to its prototype (it inherits from the “Object” prototype), plus the actual primitive Boolean-type value that you wanted to begin with.
    2. The way JavaScripts type coercion already handles boolean checks behaves badly with the Boolean object, because Objects themselves are “truthy.” E.g.
    `const dontDoThis = new Boolean(false);
    dontDoThis ? true : false //returns true`

  • @_zetrax
    @_zetrax Год назад

    that Array.from to create an array of numbers is sick 🔥

  • @rutikrathod2435
    @rutikrathod2435 Год назад

    You look indian?

  • @shanurrahman880
    @shanurrahman880 4 месяца назад

    guess what ? i didn't understand 🤣

  • @lobokun
    @lobokun Год назад +1

    if you are not applying these tricks are you even a developer?

    • @mewtru
      @mewtru  Год назад

      yes, just not a based one 😂

    • @lobokun
      @lobokun Год назад

      @@mewtru Facts.