← Back to challenges

Return a String as an Integer

JavaScriptMediumstringsnumberslanguage_fundamentals

Instructions

Create a function that takes a string and returns it as an integer.

Examples

stringInt("6") ➞ 6

stringInt("1000") ➞ 1000

stringInt("12") ➞ 12

Notes

  • All numbers will be whole.
  • All numbers will be positive.
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Area of a Rectangle