← Back to challenges

String to Integer and Vice Versa

JavaScriptHardstringslanguage_fundamentals

Instructions

Write two functions:

  1. toInt() : A function to convert a string to an integer.
  2. toStr() : A function to convert an integer to a string.

Examples

toInt("77") ➞ 77

toInt("532") ➞ 532

toStr(77) ➞ "77"

toStr(532) ➞ "532"
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Recreating the String.length Property