Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

If you're still creating and modifying URLs in JavaScript using string concatenation, this is a PSA that there is a better way:

329,459 görüntüleme • 3 yıl önce •via X (Twitter)

10 Yorum

Steve (Builder.io) profil fotoğrafı
Steve (Builder.io)3 yıl önce

Read more about using the URL constructor here:

ian.tsx profil fotoğrafı
ian.tsx3 yıl önce

If you prefer the immutable version: new URLSearchParams( Object.fromEntries({ key: "value", }) ) (Not sure if the Object.fromEntries is needed. It works in chrome without, but typescript requires it)

Fatih Aygün profil fotoğrafı
Fatih Aygün3 yıl önce

This is useful sometimes, especially for constructing the pathname component:

Shelton Louis profil fotoğrafı
Shelton Louis3 yıl önce

Keep making these videos. They are becoming very informative. What you just showed me was an eye-opener. I think I should look more into the tools I use everyday.

Url Sweatshirt profil fotoğrafı
Url Sweatshirt3 yıl önce

Damn my first thought for bugs was that you can’t use await outside of an async function.

Steve (Builder.io) profil fotoğrafı
Steve (Builder.io)3 yıl önce

You can as of recently!

Thai Pangsakulyanont profil fotoğrafı
Thai Pangsakulyanont3 yıl önce

Can also use URLSearchParams directly: `/api/v2/content?${new URLSearchParams({ model, locale, text })}`

Bao Huynh profil fotoğrafı
Bao Huynh3 yıl önce

Amazing video packed with content. I used to look at URL() constructor and wonder “why not just use template string”. Now I have realized the wrongs of mine.

Batuhan profil fotoğrafı
Batuhan3 yıl önce

Definitely like your content! What tool do you use for subtitles?

Anon Dev profil fotoğrafı
Anon Dev3 yıl önce

I love your content 😍

Benzer Videolar