IoT Inspector interview question

I had to write a digit parser with error checking in React JS.