JS vs Python

This is filler…

Moving onto similarities both object-oriented programming have similar features and different features. Both Python and JavaScript offer comments, which allows a note that does not affect your program. In python you go about a comment with a hash character (#) and it end at the physical line. With JavaScript you can comment with two forward slash (//) and it also ends at the end of the line. To accomplish a multiline comment in Python you can use triple quoted strings and for JavaScript you can use a block comment with a forward slash star closed with another star forward slash. Both language can do numbers, which allows mathematical operations. They Also both use string and are basically created the same way with simply by enclosing characters in quotes. Both single quotes or double quotes are acceptable.

Both language can store variables to be use later into the program, and they are setup basically the same. The two languages can use function which is a block of code that can be reusable or single use.  Conditional is very useful for determining whether a piece of code will run or not and both JavaScript and Python can use conditional operations. The two languages have arrays and objects that can be implemented into the program. The two languages offer many of the same core features found in many coding languages.

Example:  We can accomplish the same thing in both langaues.


As shown in the illustration we can see that the same objective can be accomplish in both Python and JavaScript. However, you can also see the difference, JavaScript requires the semicolon, while Python does not require it. Also, they both require different syntax which requires different format to accomplish the same job. One of the difference of Python and JavaScript is that Python has a simpler and elegant syntax. It can be much easier to read and write compared to JavaScript where you do not have to worry about a miss semicolon or a curly bracket. In JavaScript if you happen to miss one of those your program will give you an error.

Python is a free open-source language where it is freely to use and distribute, even for commercial use.  However, on the JavaScript side it is an implementation of the ECMAScript language standard and is use for client side, as part of the web browser in enhance user interfaces. So, because its open standard, ECMAScript is open, but not an open source. Another difference is that Python general purpose offers a wide range of applications from web, scientific and mathematical computing. Whereas JavaScript focus on enhancing user interfaces and dynamic websites.

Python is an amazing language that makes portability very easy. You can move Python program from one platform to another. So, it will all work no matter if you are working on a Mac, Windows, or Linux. On the other hand, JavaScript although it is easier to make portable program, difference in interpreters and brewers make portability difficult. Writing a JavaScript program does not guarantee portability, and you will need to consider the platform you are writing the code in.

So, depending on the application you are writing for one may justify its use.  As Python is generally a scripting that can be used for various testing, building, and other applications. If you are building a UI using web technologies, JavaScript will be the best tool for the job.

Let’s view a big difference in the two langue by using hello world as an example.

Example: Python

  1. print(“Hello, World”)

Example: JavaScript







alert( ‘Hello, world!’ );







As we can see Python hello world took far less effort, and is less complex. As in

JavaScript that is use for web application, we inserted it in a HTML document with the script tag. This pops an alert on your web browser that says “Hello, World.”

Leave a Reply

Your email address will not be published. Required fields are marked *