Video yükleniyor...
Video Yüklenemedi
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

Read more about using the URL constructor here:

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)

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

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.

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

You can as of recently!

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

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.

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

I love your content 😍
