Complete the code to read an environment variable named 'API_KEY'.
const apiKey = Deno.env.[1]('API_KEY');
The Deno.env.get method is used to read the value of an environment variable.
Complete the code to set an environment variable 'MODE' to 'production'.
Deno.env.[1]('MODE', 'production');
The Deno.env.set method assigns a value to an environment variable.
Fix the error in the code to delete the environment variable 'TEMP_VAR'.
Deno.env.[1]('TEMP_VAR');
The correct method to remove an environment variable is Deno.env.delete.
Fill both blanks to check if the environment variable 'DEBUG' exists and then read it.
if (Deno.env.[1]('DEBUG')) { const debugValue = Deno.env.[2]('DEBUG'); }
Deno.env.has checks if a variable exists. Deno.env.get reads its value.
Fill all three blanks to safely read 'PORT' with a default of '3000' if not set.
const port = Deno.env.[1]('PORT') ?? [2]; const portNumber = Number([3]);
Use get to read 'PORT'. If undefined, use default '3000'. Then convert the value stored in port to a number.
