Why you should learn JavaScript and Python in 2022 | by Andrew Baisden | CodeX | Jan, 2022

Andrew Baisden

A new year brings new opportunities for aspiring developers and people who are trying to leave their non tech role so that they can get hired as a developer. One of the most common dilemmas that these people face is figuring out what technical stack to learn and in what direction they should be going when it comes to learning a new programming language from scratch. There are endless options and many different paths that someone could choose to go down.

Arguably two of the most popular and talked about programming languages in the world are JavaScript and Python. If you search for JavaScript and Python job roles on any job board you are highly likely to see hundreds if not thousands of results. The market is and always will be hot for these two highly sought after languages and that is not going to change anytime soon. Both languages share quite a few similarities as well. They are both C based languages which essentially means that they are general purpose, procedural and have lexical scopes among other things.

One of the biggest standout points is the fact that JavaScript and Python are dynamically typed languages. In a manner of sense a dynamically typed programming language does not require variables to be explicitly declared prior to their usage. And in the reverse a statically typed programming language prevents variables from getting reassigned to a different type. All of this will become more clear in the examples below.

If you were to run this Java code you would get either a compile error or runtime error. It is not possible to reassign static types to a different type. You can only use another string like “Steve Rogers”.

Now if you were to run this JavaScript code you would get no errors as it is perfectly valid. The variable name is now the number 24.

Similarly if you were to run this Python code you would also get no errors as it is perfectly valid. The variable name is now the Int 24.

Data types are essentially ways to store data inside of an application. The type of data type specifies what can be stored and how it can be managed. Below you will find a list of some of the data types that each language has.

Text Type: string
Numeric Type: number
Boolean Type: boolean
Mapping Type: object
Sequence Type: array

Text Type: string
Numeric Type: int, float, complex
Boolean Type: boolean
Mapping Type: dict
Sequence Type: list, tuple, range

Next we will compare the syntax for both programming languages so you can see how easy it is to transition between the two of them. First let me run through a few differences between the languages.

JavaScript

  • Uses semicolons
  • Uses curly braces for code blocks
  • Uses the CamelCase naming convention for variables for example firstName
  • Uses for outputting messages to the console

Functions use this syntax:

Python

  • Does not use semicolons
  • Does not use curly braces
  • Uses the Snake Case naming convention for variables for example first_name
  • Uses indentation for code blocks
  • Uses for outputting messages to the console

Functions use this syntax:

Both languages output a string type variable

JavaScript Syntax

Python Syntax

In this example both variables output a number in JavaScript

JavaScript Syntax

Python Syntax

In this example Python is able to see the difference between a number and a float because they are built in data types

The output is almost exactly the same the only difference is that JavaScript uses a lowercase “t” for true whereas Python uses an uppercase “T”.

JavaScript Syntax

Python Syntax

In this example Python is able to see the difference between a number and a float because they are built in data types

JavaScript uses the object data structure whereas Python uses the dictionary data structure. From looking at the examples you can see that they are very alike. The difference is that JavaScript does not require quotes for the keys whereas Python requires them for the keys in the key value pair.

The keys are on the left for example name and the values are on the right for example Tony Stark.

JavaScript Syntax

Python Syntax

JavaScript uses an Array which is a type of object data structure whereas Python uses the list data structure. As you can see they have many similarities in terms of the syntax you write.

JavaScript Syntax

Python Syntax

There are many platforms you can go to if you want to learn JavaScript and Python. Personally I think that freeCodeCamp and Udemy have great courses for both of them. These are the ones that I recommend.

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/

https://www.udemy.com/course/the-complete-javascript-course/

https://www.freecodecamp.org/learn/scientific-computing-with-python/

https://www.udemy.com/course/complete-python-developer-zero-to-mastery/

https://www.udemy.com/course/complete-python-bootcamp/