The geodesic routines in GeographicLib have been implemented in
JavaScript library.  See

  https://geographiclib.sourceforge.io/html/js

William Wall <wallw@users.sourceforge.net> has posted a method of
automatically translating the C++ code into JavaScript

  https://sourceforge.net/p/geographiclib/discussion/1026620/thread/f6f6b9ff/

This will let you use other capabilities of GeographicLib in JavaScript.

This is implemented in OpenSphere ASM

  https://github.com/ngageoint/opensphere-asm
