user8546220
user8546220

Reputation: 251

How to use JavaScript in google colab?

I have added Javascript kernel to Google Colab using following commands:

!npm install -g --unsafe-perm ijavascript zeromq
!ijsinstall --install=global
!jupyter-kernelspec list

Now I want to code using JavaScript. How can I change the kernel?

Upvotes: 25

Views: 45128

Answers (3)

korakot
korakot

Reputation: 40828

I make a simplified version from @obenjiro 's answer. And make it into 2 shortened URLs (choose one).

You go there.

  • Select Copy to Drive to make it your own.
  • Run the first cell.
  • Reload the page
  • Skip the first cell.
  • Run the second cell, then run any JavaScript codes you want.

Upvotes: 23

obenjiro
obenjiro

Reputation: 3750

NEW ANSWER

There is a project called JupNode that allows you to do that (https://github.com/Graphnull/jupnode)

Here's an example https://colab.research.google.com/drive/1_Gmt-q8TCpV8q7lDmO3vikHrC9r8-0jY?usp=sharing

OLD ANSWER

I made a simple to bootstrap template that allows you to run TensroflowJS on Google Colab, install modules in notebook, and run long running async code. Just open

tinyurl.com/tf-js-colab

and you ready to go! :)

For detailed walkthrough https://dev.to/obenjiro/silence-of-the-fans-part-1-javascript-quickstart-5f3m

Upvotes: 5

John
John

Reputation: 101

After inserting %%javascript there will only be JavaScript code.

Upvotes: 10

Related Questions