JavaScript

URL API in JavaScript

JavaScriptWeb APIsURL APIintermediate

What this snippet does

The URL API parses and mutates URLs structurally — safer than string manipulation and handles encoding automatically.

Expected output

example.com
8080
/path
1
https://example.com:8080/path?bar=2&baz=3#section

Why practise typing this

Typing web apis code builds muscle memory for the symbols and indentation JavaScript uses most, which prose-based typing tests never cover. DevType measures your words per minute and accuracy on this snippet and tracks the individual characters you mistype, so later lessons can target them.

More JavaScript practice

Browse all JavaScript snippets →