You should extend functionality using JS, not use it for the main functionality.
So don't rely on any security measures to be performed using JS at all, no login attempts, nothing. Rather have that hard coded that PHP will check it no matter what. You can always use JS to do checks prior to submission or whatever you like as a "nice feature", but do not use JS as the only checking point.
Can you describe your reason for needing to know if users have modified your JS? Is it some security concern? Secure token that is sent etc?