Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 458
user8546220 Avatar asked Sep 27 '19 10:09

user8546220


People also ask

How do I run a script in Colab?

To run the code in any cell, you can click the run button on the left side of the code cell (looks like a “play” button with a triangle in a circle) or you can click [shift] + [enter]. The output will appear right below the code cell.

Can I use HTML in Google Colab?

Can I use Google colab for HTML? You can see the HTML result in the COLAB file manager pane after refreshing it by right-click and clicking “refresh”. Then, you can download it to your PC. After you get the HTML output, you can share it on any simple web server.

Can you code in Google Colab?

The Basics. Colaboratory, or “Colab” for short, is a product from Google Research. Colab allows anybody to write and execute arbitrary python code through the browser, and is especially well suited to machine learning, data analysis and education.

Is there Jupyter notebook for JavaScript?

Jupyter Notebooks are documents that contain a mix of live code (Python, R, Julia, JavaScript, and more), visualizations, and narrative text (Markdown). They're useful for breaking down concepts in a story telling form, where you can give some context and show the code below along with interactive visualizations.


2 Answers

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

  • bit.ly/colabjs
  • colab.to/js

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.
like image 57
korakot Avatar answered Oct 15 '22 21:10

korakot


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

like image 30
John Avatar answered Oct 15 '22 20:10

John