What does it mean that JavaScript is "dynamic"?

I read from various sources (e.g. wiki, articles, etc.), which means dynamics in the sense of programming. Wikipedia talks about how dynamic programming languages ​​perform certain runtime programming behaviors (as opposed to compilation times for static languages), but their explanation is vague and talks about how these behaviors vary in complexity, complexity, and performance for everyone programming languages.

So, with regard to JavaScript in particular, what does it mean that it is dynamic?

Maybe I'm wrong about this, but I also understand that JavaScript is a dynamically typed language, since you don't have a type state before instantiating a variable / function (e.g. var, function jsFunction ()), unlike a static typed language like Java, where you define the type before instantiating the variable / function (e.g. int var, public int function ()).

Is this related to this?

+8
javascript static dynamic
source share
2 answers

Most languages ​​have some aspects of dynamic behavior. Even statically typed languages ​​can have a dynamic or variant data type, which can contain different data types.

JavaScript is called a dynamic language because it has not only a few dynamic aspects, almost everything is dynamic.

All variables are dynamic (both in type and in essence), and even the code is dynamic. You can create new variables at run time, and the type of variables is determined at run time. You can create new functions at any time or replace existing functions. When used in a browser, code is added when more script files are downloaded, and you can upload more files at any time convenient for you.

JavaScript is currently compiled in many implementations, and static code and static types are generated in the background. However, the behavior is still dynamic, the compiler generates only static types when it detects that the dynamic aspects are not used for a specific object.

+9
source share

The most significant well-defined way in which JS is dynamic is that it is dynamically typed: the language has data types, but does not verify that the types of programs are β€œgood” until the program is launched. The opposite is statically typed, which means that program types are checked by a program that checks the source code before running them. (For example, Java and ML are statically typed.)

+2
source share

All Articles