Challenge - 5 Problems
URL Import Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediateWhat is the output of this Deno module import?
Consider this Deno code that imports a function from a URL and uses it.
What will be printed when this code runs?
What will be printed when this code runs?
Deno
import { greet } from "https://example.com/utils/greet.ts"; console.log(greet("Alice"));
Attempts:
2 left
💡 Hint
Think about how Deno supports importing modules directly from URLs.
✗ Incorrect
Deno allows importing modules directly from URLs. If the URL exports a function named greet, it can be imported and used as shown. The output will be the string returned by greet with the argument "Alice".
📝 Syntax
intermediateWhich import statement is valid in Deno for importing from a URL?
Select the correct syntax to import the default export from a URL module in Deno.
Attempts:
2 left
💡 Hint
Default exports are imported without braces.
✗ Incorrect
To import a default export, use `import name from 'url';`. Named exports require braces. The syntax with parentheses is invalid.
🔧 Debug
advancedWhy does this Deno import from URL fail at runtime?
This code tries to import a function from a URL but throws an error at runtime.
What is the most likely cause?
What is the most likely cause?
Deno
import { calculate } from "https://example.com/math.ts"; console.log(calculate(5));
Attempts:
2 left
💡 Hint
Check what the remote module exports.
✗ Incorrect
If the remote module does not export the named function calculate, the import will fail at runtime with an error that calculate is undefined.
❓ state_output
advancedWhat is the value of variable 'result' after this import and call?
Given this Deno code importing from a URL, what is the value of 'result' after execution?
Deno
import { double } from "https://example.com/utils.ts"; const result = double(4);
Attempts:
2 left
💡 Hint
Assume the remote module exports a function that doubles the input number.
✗ Incorrect
The imported function double multiplies the input by 2. Calling double(4) returns 8, so result is 8.
🧠 Conceptual
expertWhich statement about importing modules from URLs in Deno is TRUE?
Select the true statement about how Deno handles imports from URLs.
Attempts:
2 left
💡 Hint
Think about how Deno optimizes repeated imports from the same URL.
✗ Incorrect
Deno caches remote modules locally after the first download. This speeds up subsequent runs and avoids unnecessary network calls. It does not require manual downloads or update modules automatically every run.
