Looping Strategies?

I seriously struggled with looping through the various data sets being new to the language. In the end I ended up the with following code using lodash to reset all my environment vars at the start of each run.

name = [ "resumeURL", "loginURL", "auth_code", "access_token", "refresh_token", "opentoken","refresh" ]
_.forEach(name, (value) => { 
    pm.environment.unset(String(value),"")
});

There does appear to be an “.each” java construct but I don’t know how to use it. I would appreciate guidance from the crowd for some looping constructs like above for json, string, key/value pair and array indexes. I should not have to use lodash for this.

BONUS Points: If you have any tips on how to pull the initial value of an environment variable that would be amazing.

Hi @rtfmoz2

This may help you…