How to add legend title in javascript?

Hello everyone,
In my project using plotly.js. I try to find the solution for create the legend title, but I found only in python. Please help me how to adapt in javascript.Capture

You could set it via layout.legend.title.text.
Here is a demo.