How to hide a javascript cell using Jupyter nbdev?

When using Jupyter Notebook or Lab with nbdev, a regular python cell can be hidden by putting #hide at the top of the cell.

I would like to leverage literate programming and use also javascript with magic command, for example like this:

# hide
var kernel = IPython.notebook.kernel;
var body = document.body,  
    attribs = body.attributes;
var command = "theNotebook = " + "'"+attribs['data-notebook-name'].value+"'";

But I got the follwing error:

  File "/tmp/ipykernel_70002/", line 3
    var kernel = IPython.notebook.kernel;
SyntaxError: invalid syntax

How to get ride of this error with keeping this cell hidden in the documentation ?