Better reading and writing URLs in modern JavaScript

Sdílet
Vložit
  • čas přidán 9. 01. 2023
  • You can read more about what else you can do with the URL constructor in my latest article on the Builder.io blog here: www.builder.io/blog/new-url
    #js #javascript #webdev

Komentáře • 203

  • @Steve8708
    @Steve8708  Před rokem +20

    More on what you can do with the URL constructor, and related patterns, in my full article: www.builder.io/blog/new-url

  • @MobiusCoin
    @MobiusCoin Před rokem +396

    These videos are really making a good case for YT Shorts.

    • @traviswatson6527
      @traviswatson6527 Před rokem

      As a sales pitch?

    • @nnrmnlg
      @nnrmnlg Před rokem +3

      no they're not. you can't even save them to a playlist

    • @alice1374
      @alice1374 Před rokem

      @@nnrmnlg Just bookmark them or save them to an external platform

    • @qwerty_qwerty
      @qwerty_qwerty Před rokem

      @@nnrmnlg Watch history

  • @carltongordon
    @carltongordon Před rokem +51

    Binge watching these shorts has taught me so much!!! Feel way more confident

  • @zachariahtatman7381
    @zachariahtatman7381 Před rokem +10

    BRO you are quickly becoming my favorite shorts coder!! You don’t just tell us what to use, but present a problem, explain why it’s a problem, and lastly a solution and why it solves previously said problem!! 🤩😮‍💨❤️ goddamn you gotta love a content creator like this

    • @stardrake691
      @stardrake691 Před rokem

      I totally agree with you, this style of teaching is so good it makes information stick into watchers’ head.

  • @BboyKeny
    @BboyKeny Před rokem +6

    I like to imagine that these kind of video's prevents many bugs in the future, which means less money wasted on debugging, less frustration for the end users and many careers saved.

  • @Jaxer4
    @Jaxer4 Před 8 měsíci

    Bro I learned JavaScript in 2012 coming back to it over 10 years later is so wild 😂 there's so much new shit

  • @thatsalot3577
    @thatsalot3577 Před rokem +19

    This was a really good video, I almost forgot about template literals and how they behave with linebreaks.

  • @timi_t_codes
    @timi_t_codes Před 9 měsíci

    Such quality in youtube shorts is hard to come by 🔥. Just watching this has improved the quality of my JS code

  • @RonaldDas42
    @RonaldDas42 Před 9 měsíci

    Wow this is so useful. Never knew about the URL constructor

  • @shrushtidesai4164
    @shrushtidesai4164 Před 11 měsíci

    Finally a video where the auto generated captions doesn't hide the actual captions. Thanks!

  • @tommasochiti4237
    @tommasochiti4237 Před rokem +1

    this is the first channel that gives solid advices, not opinionated "use this framework cause is better" stuff

    • @soniablanche5672
      @soniablanche5672 Před rokem

      nodejs tutorials be like "use the uuid package to generate uuid4" when nodejs has TWO ways of generating uuid4 natively lmao

  • @ColinRichardson
    @ColinRichardson Před rokem

    I'm glad I spotted the new line char first.

  • @josh-dev
    @josh-dev Před rokem +4

    Always putting out gems Steve

  • @rjwhite4424
    @rjwhite4424 Před 10 měsíci

    Had ZERO clue about this. This is awesome

  • @GordonChil
    @GordonChil Před rokem +1

    I like the idea of using a tagged template with a key-Val parameter object to make it more concise.

  • @nithinharsha6953
    @nithinharsha6953 Před rokem

    You are making great videos learning so much from them you are my fav youtuber now keep going and thank you making the videos.

  • @shubhk33
    @shubhk33 Před rokem +1

    Actually a useful short

  • @Cgxy2024
    @Cgxy2024 Před rokem +1

    love your content, not shallow knowledge, really helpful stuff 🎉

  • @missedme0063
    @missedme0063 Před rokem

    new URL is a cool trick, thanks! 😊

  • @codinginflow
    @codinginflow Před rokem

    That tip is gold

  • @adimardev1550
    @adimardev1550 Před rokem

    oh boy! this is just my lucky day! thanks for such video man. keep up on doing great stuff!

  • @lutfiikbalmajid
    @lutfiikbalmajid Před rokem

    your tips are always awesome. 🤯 i will start documenting your tips in my notes blog, so I'll always remember.

  • @GolderiQ
    @GolderiQ Před rokem

    Thank you very much for that tiny, yet incredibly valuable, piece of information 🤝

  • @muhammadmejanulhaque3305

    thank you so much. I just encoded a url like the bug you shared couple of days ago. love your content

  • @closetothee3785
    @closetothee3785 Před rokem +3

    Good to know the Url stuff. But it's not necessarily a bug without encoding parameters.

    • @AR7editing
      @AR7editing Před rokem

      it is, if you pass a line with + or another converted parameter it behave really different

  • @Amar11115
    @Amar11115 Před 11 měsíci +1

    Learned a lot in 1 min video😂 thanks!

  • @PaulSebastianM
    @PaulSebastianM Před 9 měsíci

    Basic principles for BE developers... it always astounds me how script-kiddy FE/JS world is.

  • @TheChuckFina
    @TheChuckFina Před rokem +5

    I don't know a damn thing about coding, but still found this interesting.

    • @RaefetOuafiqo
      @RaefetOuafiqo Před 10 měsíci

      you will one day. since youtube shows this content, you will become eventually a coder

  • @samuelkinuthia995
    @samuelkinuthia995 Před rokem

    Very cool. I was actually tested on this during an interview. 😊

  • @Wink-Wright
    @Wink-Wright Před 10 měsíci

    Fantastic pacing and very informative!

  • @mohitmalhotra4276
    @mohitmalhotra4276 Před rokem

    Best tech channel of all times

  • @ra-pe9bi
    @ra-pe9bi Před rokem

    Love the content, keep up good work!

  • @toferj7441
    @toferj7441 Před rokem

    Learned something new today. Thanks!!

  • @prajjwalrajput908
    @prajjwalrajput908 Před 11 měsíci

    I’m getting addicted to your these hacks thanks you

  • @rdalago
    @rdalago Před rokem

    Learning so much from you! Thanks!!!!

  • @SpirosArgiroiliopoulos
    @SpirosArgiroiliopoulos Před 10 měsíci

    Congrats JS you've found out OOP. Nice video btw :)

  • @brigaderog177
    @brigaderog177 Před rokem

    Big thank you. Learned something new today

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

    Nice one. You should have also added why encoding query Param is necessary.

  • @nicolasmayorga8288
    @nicolasmayorga8288 Před rokem

    Amazing!
    Thanks for it I've always done it the "bad way"

  • @abhaykamath2988
    @abhaykamath2988 Před 11 měsíci

    Really helpful !! Thanks !!

  • @ochaun
    @ochaun Před rokem +1

    Love this one. Another bug in the code is xss. Not only can malicious user supplied input cause an open URL redirect, but you can pull session cookies, jwts, etc.

  • @CanRau
    @CanRau Před rokem

    Yes use this all the time🎉

  • @chakhmanmohamed9436
    @chakhmanmohamed9436 Před rokem

    Very very helpful

  • @spectralspace8866
    @spectralspace8866 Před 10 měsíci

    Thank you so much!

  • @XiaZ
    @XiaZ Před rokem +1

    I like to use URLSearchParams so I can just pass an object and not setting each param separately like this.

  • @brayancuenca6925
    @brayancuenca6925 Před rokem

    Loved this

  • @baka_baca
    @baka_baca Před rokem

    Oh nice and simple

  • @dawid_dahl
    @dawid_dahl Před rokem

    Great tips!

  • @johleonhardt5637
    @johleonhardt5637 Před rokem

    Can you more videos please this is awesome ❤

  • @guillaume5623
    @guillaume5623 Před rokem +1

    This is gold

  • @Rakusan2
    @Rakusan2 Před rokem

    You can also easily make tags for template strings

  • @imachomanjewelry
    @imachomanjewelry Před rokem

    Super great. keep going!

  • @GSK-Tech
    @GSK-Tech Před rokem +1

    good one

  • @danijeldzakula8709
    @danijeldzakula8709 Před rokem +1

    Tnx bro 😎

  • @kalyankumar9663
    @kalyankumar9663 Před rokem

    Nice and clean

  • @pranupranav6279
    @pranupranav6279 Před rokem +1

    Thanks

  • @emakei
    @emakei Před rokem

    Wow. Awesome

  • @kunalkeshan6879
    @kunalkeshan6879 Před rokem

    Really cool

  • @YamiSuzume
    @YamiSuzume Před rokem

    The bigged "bug" her is the absence of Semicola :D

  • @robottrainer
    @robottrainer Před rokem

    oh man this is great!

  • @youjirogaming1m4daysago

    Thank you❤

  • @bryanguner4455
    @bryanguner4455 Před rokem +2

    There’s another potential bug… await doesn’t make sense outside of the context of an asynchronous function…

  • @pupfriend
    @pupfriend Před rokem

    How good!

  • @ouhoy
    @ouhoy Před rokem

    Thank you so much

  • @kokngonose
    @kokngonose Před rokem

    Youre so genius

  • @rutpshah
    @rutpshah Před rokem

    Good. Thank you

  • @hassamulhaq7762
    @hassamulhaq7762 Před rokem

    Amazing 🤩

  • @HimanshuKumar-rn1cn
    @HimanshuKumar-rn1cn Před rokem

    you have to use await inside an async function, that is the first thing I noticed

  • @IndianGermanDiaries
    @IndianGermanDiaries Před rokem +1

    Great ❤

  • @AvenDonn
    @AvenDonn Před rokem

    Same vibes as learning about SQL parameters

  • @tryndamerematchup6988
    @tryndamerematchup6988 Před 11 měsíci

    Wow Thanks

  • @rodrigorcs
    @rodrigorcs Před rokem

    I might be wrong but as far as I can remember, you can also pass query params as an object

  • @leojohn6702
    @leojohn6702 Před rokem

    Ok ok ok. Subscribed. ❤

  • @NicoHeinrich
    @NicoHeinrich Před rokem

    holy shit, this is NICE

  • @sc76399
    @sc76399 Před 10 měsíci

    Didn't know about that. I usually set the URL as a string and then use URLSearchParams and pass in an object to the constructor and then pop it in the string and there you go

  • @yasyaindra
    @yasyaindra Před rokem

    great video. wish i can save it

  • @ollyb8211
    @ollyb8211 Před rokem

    for handling rest apis in a type safe way give ts-rest a go!

  • @yousafwazir3167
    @yousafwazir3167 Před rokem

    Amazing

  • @shuminzhou2268
    @shuminzhou2268 Před rokem +1

    Like it

  • @alexjones420
    @alexjones420 Před rokem

    Nice

  • @dataSMASH
    @dataSMASH Před rokem

    This is a cool tip but axios makes this super easy too. Just add the Params obj

  • @artecke99999
    @artecke99999 Před rokem

    I love it! thanks tho!

  • @filcondrat
    @filcondrat Před rokem

    nice

  • @reactnativecoder
    @reactnativecoder Před rokem

    Enjoy your reels with JavaScript better ways to use

  • @metasal
    @metasal Před rokem

    That’s $100 worth of knowledge there in just 60 seconds and it’s free 🤯

  • @kimbapslayer1995
    @kimbapslayer1995 Před rokem +9

    Don’t you also need to be in an async function when using await?

  • @r.avinashkumar5372
    @r.avinashkumar5372 Před rokem

    you can download these if required

  • @Eroenjin
    @Eroenjin Před rokem

    Also URLs have maximum length

  • @AbdullahBRashid
    @AbdullahBRashid Před rokem

    You can also create an object with the query params and values and pass it to fetch directly.
    Correct me if Im wrong plz

  • @neelthakkar4492
    @neelthakkar4492 Před rokem

    I don't have much experience with fetch but I think just one await will not lead to your desirable response as you will get stream of response. Instead you will want to use .json method or something along that and await it again to get response in json format. I just think it's an error too.

  • @henriqueferr8623
    @henriqueferr8623 Před rokem +1

    Also there's no error handling in the fetch

  • @anhvuuc8693
    @anhvuuc8693 Před rokem

    so usefull. We can use qs-string package too

    • @soniablanche5672
      @soniablanche5672 Před rokem +1

      why use a package when there's a native class for it

    • @anhvuuc8693
      @anhvuuc8693 Před rokem

      @@soniablanche5672 some db need query like {a:{b:3}} => [a][b]=3
      You will need that

  • @patchstep
    @patchstep Před rokem

    Also the top-level await

    • @Steve8708
      @Steve8708  Před rokem

      Top level await is supported in all modern browsers, and even Node.JS and Deno developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await#

  • @razorjhon2622
    @razorjhon2622 Před rokem

    Steve how long have u been coding , i have never heard of this in my entire life :O

  • @MegaFriggo
    @MegaFriggo Před 11 měsíci

    Welcome to Object world

  • @MattBidewell
    @MattBidewell Před rokem

    Fun fact - the URL constructor is actually flawed! However it's unlikely to affect standard use

  • @judostuff9233
    @judostuff9233 Před 10 měsíci

    Good stuff here, but shouldn't that block of code be wrapped in a async function also?

  • @arminlinzbauer
    @arminlinzbauer Před rokem

    The viewer doesn't get to see the three parameter variables' assignment, so for all we know they could've been encoded already. Hard to notice this as a big without a bit more context.
    Also, when refactoring the code with searchParam.set, you turned query.text into just text.

  • @leojohn6702
    @leojohn6702 Před rokem

    Do you have any video for js performance?

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

    Depending on how those variables get their values, there might also be a risk of an SQL-injection-like bug.

    • @klamberext
      @klamberext Před rokem

      That is BE to worry about since it can only know what the db expects for escape. You can do some cleanup, but never trust it.