Position in the Alphabet

Published by Mubashir Hassan in

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

Examples

letterAtPosition(1) ➞ "a"

letterAtPosition(26.0) ➞ "z"

letterAtPosition(0) ➞ "0"

letterAtPosition(4.5) ➞ "0"

Notes

  • Return a lowercase letter.
  • Numbers that end with ".0" are valid.
Watch a quick demo on how Edabit works.