Complete the code to correctly reference a variable in Postman.
pm.environment.set([1], '12345');
In Postman scripts, variable names must be passed as strings when setting environment variables.
Complete the code to retrieve a variable value using Postman variable syntax.
const token = pm.variables.get('[1]');
When retrieving a variable, pass the variable name as a string without curly braces.
Fix the error in the code to correctly use a variable in a request URL.
const url = `https://api.example.com/users/$[1]/details`;Inside template literals, you must embed JavaScript expressions, not Postman variable syntax.
Fill both blanks to correctly set and then use a variable in Postman scripts.
pm.environment.set('[1]', '12345'); const id = pm.environment.get('[2]');
Use the same variable name when setting and getting to maintain consistency.
Fill all three blanks to create a dynamic request URL using Postman variables.
const baseUrl = pm.environment.get('[1]'); const user = pm.variables.get('[2]'); const fullUrl = `$[3]/users/${user}/profile`;
Retrieve variables by their names as strings, then use JavaScript variables inside template literals.