Is it possible to add javascript in bubble?

Yes you can .
There are a couple of ways to do so.
The first way is to create a Bubble plugin and add your JS code there.
You can also use the Toolbox plugin to add JavaScript in.
You can also add in a HTML element and put the HTML in there. Any Javascript can be added in between the script tags via the HTML element.