Fitting function with plotly.js

I have a problem that I want to plot a fit line for scatter points using plotly.js, but which function can I use in the plotly.js

Curve fitting is not part of Plotly.js. You would have to write your own curve fitting routine in JavaScript, or use another curve fitting library.