Multi layer perceptron in JavaScript