# Newman can't read number from variable "TypeError in test-script"

**URL:** <https://community.postman.com/t/newman-cant-read-number-from-variable-typeerror-in-test-script/30767>\
**Category:** Help Hub\
**Tags:** tests, variables\
**Created:** [December 16, 2021, 12:59pm UTC](https://community.postman.com/t/newman-cant-read-number-from-variable-typeerror-in-test-script/30767 "2021-12-16T12:59:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![johannessss](https://avatars.discourse-cdn.com/v4/letter/j/c5a1d2/32.png) [@johannessss](https://community.postman.com/u/johannessss)\
**Post date:** [December 16, 2021, 12:59pm UTC](https://community.postman.com/t/newman-cant-read-number-from-variable-typeerror-in-test-script/30767/1 "2021-12-16T12:59:26Z")

</div>

_My question_:  
I created tests for my API under Windows10 in Postman.  
The tests are running great in Postman on Windows and directly on the Linux-Server with Newman.  
The only thing which is making trouble is the Newman-Test in Windows. It gives me a “TypeError in test-script”. The reason: I have a variable which I want to convert into a number, but newman can’t handle it. I tried the follwing:

1. let limit = pm.variables.get(‘myVar’).toNumber();  
Result:

> TypeError in test-script

1. let limit = Number(pm.variables.get(‘myVar’));  
Result:

> `NaN`

1. let limit = parseInt(pm.variables.get(‘myVar’),10);  
Result:

> `NaN`

1. let limit = +pm.variables.get(‘myVar’);  
Result:

> `NaN`

1. let limit = Math.floor(pm.variables.get(‘myVar’));  
Result:

> `NaN`

1. let limit = pm.environment.get(‘myVar’);  
Result:

> `undefined` (but I defined it in the environment to test this)

1. let limit = 1000;  
Result:

> 1000

Only idea #7 works.

I really don’t understand what is going on there. I thought it could be a Newman-Bug, but it’s working great on Linux with Newman.

Does anybody has an idea?
