Perceptron written in javascript