Most Left Digit

Published by Matt in

Write a function that takes a string as an argument and returns the left most digit in the string.

Examples

leftDigit("TrAdE2W1n95!") ➞ 2

leftDigit("V3r1ta$") ➞ 3

leftDigit("U//DertHe1nflu3nC3") ➞ 1

leftDigit("J@v@5cR1PT") ➞ 5

Notes

  • Each string will have at least two numbers.
  • Return the result as an integer.
Watch a quick demo on how Edabit works.