simple javascript code implementation of elliptic curve