/Python-JavaScript

Using Jupyter Notebooks comparing JavaScript and Python code side-by-side.

Primary LanguageJupyter Notebook


Python-JavaScript


I started working with Flask and JavaScript a few weeks for a new project. When working with JS, I was noticing that Python and JS seemed similar. I thought it would be interesting to build notebooks showing the same tasks completed in both languages.

For now, I am using Jupyter Notebooks with a Python 3 kernel. Then when running a cell with JS code simply start the cell with %%js or %%javascript (magic commands). However, I can only log/print one line at a time and have to use element.text instead of console.log.

Additionally, I tried using JupyterLab and was unable to run JavaScript the same way in the classic notebook. However, you can use a JaveScript (Node.js) kernal and simply run JavaScript.

Install JavaScript kernel Jupyter Notebook

Built-in Magic Commands


001 Strings

  • Strings
  • Numbers and Strings
  • More Strings

002 Functions

  • Functions
    • Simple Function
    • Passing Parameters
    • Passing Parameters with Defaults
    • *args and **kwargs
    • Nameless Functions
    • Anonymous Functions Arrow & Lambda
    • Arrow Function & forEach

003 If...then...else Statements

  • Simple If

    NEED TO ADD MORE / UPDATES REQUIRED


004 JavaScript Array & Python List

  • Length of Objects
  • Type & typeOf
  • Indexing
  • Return All
  • Slicing, Dicing & Splicing
  • Modifying
  • Looping over Array forEach & List enumerate

005 Popular Methods

  • Filter
  • Includes | in
  • Join
  • Split
  • Map

Adding Reduce and more


004 JavaScript Objects & Python Dictionaries


006 Classes

Comparing the JavaScript and Python class. We start with exploring the JS constructor pre ES6 and then switch to post ES6 when JS introduces class.