Forward and reverse mode auto differentiation for JavaScript