Hey there, how are you? Is everything fine? Hopefully, you are saying yes. But for those who are saying no, I can only pray to happen all the things fine.
Today I am with a new Javascript tutorial that is on - “Datatypes in Javascript.”
Have you heard about the work Datatype before? Yes for sure if you have learned any other programming language. Datatype, as it name say that its a type of data. Means which type of value is going to be stored in a variable, is pointed through this datatype. But in Javascript, it’s not the case. Want to know how? Go ahead!
Javascript is a dynamic type programming language. You don’t have to specify any datatype to hold the value. In javascript, you have to just type var and the name of a variable. It will automatically be fetched up by the Javascript Engine. It can hold any type of value like number, string etc. e.g.
var name = "Pooja"; // holding string valuevar rollno = "45"; // holding number value
We have two types of Datatypes in Javascript:
- Primitive Datatypes
- Non-primitive datatypes.
List of primitive datatypes in Javascript:
- String
- Number
- Boolean
- Undefined
- Null
Are you expecting explaination from me? Yes, okay I will definitely provide you. Relax
String is a datatype that holds the sequense of character.
Number is a datatype that holds the number value like 0,1,2, etc.
Boolean is a datatype that return only two values true or false. And unidefined represents the undefined value like which is not defined or declared.
Null holds no value.
Now its turn for non-premetive datatypes. Let’s get started with it too.
I am providing the list of non-premitive datatypes here:
- Object
- Array
- RegExp
Let me tell you in very short the use of above three.
Object is an instance through which we can access members.
Array represents a group of similer values.
RegExp is a like a mix mode. e.g. [email protected].
Example of Javascript variables is given below:
Javascript Code Placement inside.
JavaScript Reserved Words
A list of all the reserved words in JavaScript are given in the following table. They cannot be used as JavaScript variables, functions, methods, loop labels, or any object names.
| abstract
boolean break byte case catch char class const continue debugger default delete do double |
else
enum export extends false final finally float for function goto if implements import in |
instanceof
int interface long native new null package private protected public return short static super |
switch
synchronized this throw throws transient true try typeof var void volatile while with |