Diffie-Hellman server/client generated secret size
The issue is plain and simply: JavaScript sucks.

In this particular case the issue is that JS has no integer type, so everything is stored as a double. In particular the last calculation $13^{16}$ would yield a 60-bit integer which JS computes as ordered. However double only has 52 bits for the mantissa and so can't possibly contain the full value. So JS rounds. Then it takes the rounded number and applies the $\bmod 23$ reduction yielding some unrelated value to the one you intended to compute.