Cannot find method of adding two environment variables together to get result i.e. 4 +7 = 11

My question:
I am trying to add two environment variables together to get a result i.e. 4 + 7 expecting 11, however when I put the + sign in it simply merges them to give a result of 47.

I have a similar requirement to confirm that variable a - variable b also equals 11. I can get this working with this test below

pm.test (“Check balance correct”, function () {
var jsonData = pm.response.json();
pm.expect(jsonData[0].id).to.eql(pm.environment.get(“id1”)-(pm.environment.get(“id2”)));

How I found the problem:
I am trying to confirm that after in a get have been obtained and written to the environment variables, followed by a Post that will reduce one value and increase another that the result that is sent in the response body matches that expected.

I’ve already tried:
I have tried putting the + inside “” and () but this does not work, I have also tried Add, none of which work.

Hey @pabloh1

You need to use parseInt() here to convert the variable, which is stored as a string, to an int.

This is an example of using the console to log out the sum value.

console.log(parseInt(pm.environment.get("id1")) + parseInt(pm.environment.get("id2")))