← Back to challenges

Position in the Alphabet

JavaScriptHardnumberslanguage_fundamentals

Instructions

Given a number between 1-26, return what letter is at that position in the alphabet. Return "invalid" if the number given is not within that range, or isn't an integer.

Examples

letterAtPosition(1) ➞ "a"

letterAtPosition(26.0) ➞ "z"

letterAtPosition(0) ➞ "invalid"

letterAtPosition(4.5) ➞ "invalid"

Notes

  • Return a lowercase letter.
  • Numbers that end with ".0" are valid.
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Rectangle in Circle