A JupyterLab extension for running JavaScript from a notebook in JupyterLab.
This extension is in the official JupyterLab distribution.
from IPython.display import Javascript
Javascript('alert("hello world");')
See the JupyterLab Contributor Documentation.