This short bit of code uses Machine Learning to find a line that best fits the given variables (x, y).
Neural Networks
Here are some examples of Neural Networks in JavaScript:
Simple Linear Regression
Click in the canvas area to create new circles and see how they influence the regression line.