Coding challenge

Write some code that will take in a variable $x$ and $n$, and will return the $n^{th}$ digit of $x$ (from the right). As test, if $x=12345$ and $n=2$, your code should return a $4$.

Type your code here:

Lua reference

See your results here:

Show a friend, family member, or teacher what you've done!

Here is a share link to your code: