Following postman docs pm.variables.set() sets a local variable.
But I haven’t found the name of variable without pm.variables.set().
It works differently. I get how to work ith it but I want to be better in the theory.
There are a number of different variable scopes within Postman and their usage depends on the context.
When you set a variable value using pm.variables.set , the value is local and will only persist for the current request or collection run. That value doesn’t get stored anywhere and cannot be reused outside of that request.
When using pm.variables.get() it’s slightly different, that will search through each variable scope (global, collection, environment, data, local(using pm.variables.set())) and return the variable in the narrowest scope, if it has the same name.
For example, saving a variable with the same name to the Collection and Global scope, would log the Collection variable to the console as it has the narrowest scope.
Thank you for your answer with pm.****(). You helped to correct my question.
What is the scope of variables without postman/pm. commands?
Is it also local variable but in JS scope?
Or am i wrong?