Crypto isn't the most common thing in JS. :-) That version will likely (depending on how that's compiled) take longer on iterations where there is a mismatch. So you could still play a similar game because the codepath changes when you hit on the right byte. Django has the equivalent function with bit operations in it's source.

https://github.com/django/django/blob/master/django/utils/crypto.py#L79