Two Factor Authentication Javascript Interview Question