JavaScript is weakly typed

JavaScript is a dynamically typed language that is weakly typed (loosely typed)

Python is a dynamically typed language that is strongly typed.

In JavaScript,

var a = "string+";
console.log(a + 7);
string+7
  • This often called type coercion in JavaScript and it can lead to some unintended consequences. This is not possible in strongly typed language like Python.

In Python,

 = "string+"
print(a+17)
a
TypeError: can only concatenate str (not "int") to str
Strong vs Weak typed language & Dynamic vs Static typed language

Leave a Reply

Your email address will not be published.

ANOTE.DEV