The JavaScript types are only six according to ECMA language specification. They are :
Static VS Dynamic
Static means "at compile time" and dynamic means "at runtime".
Static Typing VS Dynamic Typing
In a static typed language, variables, parameters and members of the objects have types that the compiler knows at compile time.
Even in static type language, the variable also has dynamic type language. The dynamic type can differ from static type. For Ex :
Object a = 'hello';
The static type of a is Object and it's dynamic type is String. JavaScript is dynamically typed, types of variables are generally not known at compile time.
- undefined, null
- Boolean
- Number
- String
- Object
And the Constructors don't introduce any new types.
Static VS Dynamic
Static means "at compile time" and dynamic means "at runtime".
Static Typing VS Dynamic Typing
In a static typed language, variables, parameters and members of the objects have types that the compiler knows at compile time.
Even in static type language, the variable also has dynamic type language. The dynamic type can differ from static type. For Ex :
Object a = 'hello';
The static type of a is Object and it's dynamic type is String. JavaScript is dynamically typed, types of variables are generally not known at compile time.
No comments:
Post a Comment