CHAPTER - 6
All programming languages in the world have data types. So, JavaScript is not an exception. Javascript also has pre-defined or built-in data types as well as user-defined data types.
But JavaScript is a loosely typed language. That means one does not need to mention data types specifically. In the case of Java, C++ and C, one has to define data type specifically and only that kind of data can be stored in that variable.Statically Typed language
Must define the data type of the variable before using it.
C, C++ Java, Typescript
Int a=10;
a=’Rajesh’ // ErrorString name = 10;
Dynamic Typed Language
In Javascript
var a =10 // fine
a =”Rajesh” // fine
There are the following types of data types in Javascript
Boolean: true/false
Null: nullUndefined: undefined
Number: 10,20 etc
String: “Hello”
Object: obj={}Symbol: Symbol
Comments
Post a Comment