As PointZeroTwo points out inside the remarks, the code could possibly be improved so it could return successful/failure result. You'll be able to see a demo on this jsFiddle. How do I learn the best way to learn? To learn how you can learn, test experimenting with different key ideas https://thca-positive-benefits56665.suomiblog.com/the-definitive-guide-to-industry-experts-55228659