← Back to challenges

String or Integer?

JavaScriptHardnumbersstringslanguage_fundamentalsvalidation

Instructions

Create a function that checks if the argument is an integer or a string. Return "int" if it's an integer and "str" if it's a string.

Examples

intOrString(8) ➞ "int"

intOrString("Hello") ➞ "str"

intOrString(9843532) ➞ "int"

Notes

Input will either be an integer or a string.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Height of an Equilateral Triangle