18 lines
469 B
Markdown
Raw Normal View History

2018-10-12 15:37:13 -04:00
---
title: Use the parseInt Function
---
## Use the parseInt Function
2019-01-15 14:54:07 -08:00
The ```parseInt()``` function will take any ```string``` parameter representing a number and return its integer value.
2018-10-12 15:37:13 -04:00
2019-01-15 14:54:07 -08:00
## Hint 1
```parseInt()``` should be used inside your function and return whatever ```str``` is, assuming that ```str``` is a string representing some number.
2018-10-12 15:37:13 -04:00
2019-01-15 14:54:07 -08:00
## Solution
```javascript
function convertToInteger(str) {
return parseInt(str);
}
2018-10-12 15:37:13 -04:00
2019-01-15 14:54:07 -08:00
convertToInteger("56");
```