You are here: Home / Topics / Is javascript a statically typed or a dynamically typed language?

Is javascript a statically typed or a dynamically typed language?

Filed under: JavaScript Interview Questions on 2022-07-04 19:29:28

JavaScript is a dynamically typed language. In a dynamically typed language, the type of a variable is checked during run-time in contrast to a statically typed language, where the type of a variable is checked during compile-time.

Since javascript is a loosely(dynamically) typed language, variables in JS are not associated with any type. A variable can hold the value of any data type.

For example, a variable that is assigned a number type can be converted to a string type:

var a = 23;

var a = "Hello World!";

About Author:
D
Deepak Sahoo     View Profile
I am preparing for UPSC. My dream is to be IAS.