SImple linear regression with JavaScript