JS Built-ins
← URL17 / 20
URLbeginner

URL.canParse() β€” invalid URL returns false

πŸ“– Usage Example
const blob = new Blob(['hello'])
URL.createObjectURL(blob)  // β†’ 'blob:...'

URL.createObjectURL() creates a temporary URL pointing to a Blob or File.

URL.canParse() β€” invalid

URL.canParse() returns false for strings that are not valid absolute URLs (without a base).

Challenge: Verify that URL.canParse('not-a-url') returns false.

πŸ’‘ Hints (1)
  • β€’ Without a base, a relative path is not a valid URL