Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

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 Aufrufe • vor 3 Jahren •via X (Twitter)

10 Kommentare

Profilbild von Steve (Builder.io)
Steve (Builder.io)vor 3 Jahren

Read more about using the URL constructor here:

Profilbild von ian.tsx
ian.tsxvor 3 Jahren

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)

Profilbild von Fatih Aygün
Fatih Aygünvor 3 Jahren

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

Profilbild von Shelton Louis
Shelton Louisvor 3 Jahren

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.

Profilbild von Url Sweatshirt
Url Sweatshirtvor 3 Jahren

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

Profilbild von Steve (Builder.io)
Steve (Builder.io)vor 3 Jahren

You can as of recently!

Profilbild von Thai Pangsakulyanont
Thai Pangsakulyanontvor 3 Jahren

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

Profilbild von Bao Huynh
Bao Huynhvor 3 Jahren

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.

Profilbild von Batuhan
Batuhanvor 3 Jahren

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

Profilbild von Anon Dev
Anon Devvor 3 Jahren

I love your content 😍

Ähnliche Videos