Загрузка видео...

Не удалось загрузить видео

На главную

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 просмотров • 3 лет назад •via X (Twitter)

Комментарии: 10

Фото профиля Steve (Builder.io)
Steve (Builder.io)3 лет назад

Read more about using the URL constructor here:

Фото профиля ian.tsx
ian.tsx3 лет назад

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
Fatih Aygün3 лет назад

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

Фото профиля Shelton Louis
Shelton Louis3 лет назад

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
Url Sweatshirt3 лет назад

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

Фото профиля Steve (Builder.io)
Steve (Builder.io)3 лет назад

You can as of recently!

Фото профиля Thai Pangsakulyanont
Thai Pangsakulyanont3 лет назад

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

Фото профиля Bao Huynh
Bao Huynh3 лет назад

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
Batuhan3 лет назад

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

Фото профиля Anon Dev
Anon Dev3 лет назад

I love your content 😍

Похожие видео