0
0
Postmantesting~10 mins

Iteration count in Postman - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to get the current iteration count in Postman.

Postman
let currentIteration = pm.info.[1];
Drag options to blanks, or click blank then click option'
Aiteration
Bcount
Cindex
Dnumber
Attempts:
3 left
💡 Hint
Common Mistakes
Using pm.info.count instead of pm.info.iteration
Using pm.info.index which does not exist
Using pm.info.number which is incorrect
2fill in blank
medium

Complete the code to log the current iteration count in the Postman console.

Postman
console.log('Current iteration:', pm.info.[1]);
Drag options to blanks, or click blank then click option'
Astep
Biteration
Ccount
Dcycle
Attempts:
3 left
💡 Hint
Common Mistakes
Using pm.info.count which is not a valid property
Using pm.info.step or pm.info.cycle which do not exist
3fill in blank
hard

Fix the error in the code to correctly check if the current iteration is the first one.

Postman
if (pm.info.[1] === 0) {
    console.log('First iteration');
}
Drag options to blanks, or click blank then click option'
Acount
Bnumber
Citeration
Dindex
Attempts:
3 left
💡 Hint
Common Mistakes
Using pm.info.count which is undefined
Using pm.info.index which is not a valid property
4fill in blank
hard

Fill both blanks to create a loop that runs for the total number of iterations in Postman.

Postman
for (let i = 0; i < pm.info.[1]; i[2]) {
    console.log('Iteration:', i);
}
Drag options to blanks, or click blank then click option'
Aiterations
Biteration
C++
D--
Attempts:
3 left
💡 Hint
Common Mistakes
Using pm.info.iteration instead of iterations for total iterations
Using i-- which would cause an infinite loop
5fill in blank
hard

Fill all three blanks to store the current iteration, total iterations, and check if it is the last iteration.

Postman
let current = pm.info.[1];
let total = pm.info.[2];
if (current === total - [3]) {
    console.log('Last iteration');
}
Drag options to blanks, or click blank then click option'
Aiteration
Biterations
C1
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using pm.info.count instead of iterations
Using 0 instead of 1 when subtracting to check last iteration