Why javascript called as dynamic language ?

Amit Kumar Maurya
2 min readApr 16, 2023

--

Today we will get to know why javascript called as dynamic language.
As per my understanding there are mainly two reasons to call javascript as dynamic language.

1. Variables

Compare to other languages like c, c++ and java etc we have to pre define the datatype of variable means if we want to assign a string to a variable we have to declare the variable as a string and same for integer and so on.

string abc = 'i am string';
abc = 10 // This is wrong assginment

But in javascript we have flexibility to change the datatype of the variable at the runtime also means if we assigned a variable with string value then later in the program we change that value to number and if required we change that to boolean as well.

var data = 'I am string';

data = 10;

data = true;

2. Errors

Unlike other programming languages like C and Java, JavaScript does not provide compile-time error detection. In Java, if we make any mistakes, we can identify them during the compilation process.

System.out.println(data)
// we will find out the error at the time of compilation

But in Javascript we will be able to see the error only when we run the program.

console.log(data);

//we will see the error in browser

let me know your thoughts on this and if you have any other reason please let me know in the comment section.

--

--