0% found this document useful (0 votes)
2 views8 pages

Data Types in Java Script N

JavaScript has 8 data types: String, Number, Bigint, Boolean, Undefined, Null, Symbol, and Object. The Object data type can include built-in objects like arrays and dates, as well as user-defined objects. JavaScript is dynamically typed, allowing variables to hold different data types over time.

Uploaded by

aatishstudy12
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views8 pages

Data Types in Java Script N

JavaScript has 8 data types: String, Number, Bigint, Boolean, Undefined, Null, Symbol, and Object. The Object data type can include built-in objects like arrays and dates, as well as user-defined objects. JavaScript is dynamically typed, allowing variables to hold different data types over time.

Uploaded by

aatishstudy12
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

JavaScript Data Types

JavaScript has 8 Datatypes


String
Number
Bigint
Boolean
Undefined
Null
Symbol
Object

The Object Datatype


The object data type can contain both built-in objects, and user defined
objects:

Built-in object types can be:

objects, arrays, dates, maps, sets, intarrays, floatarrays, promises, and


more.

let x=10
[Link](typeof x);
output:

let x='10'
[Link](typeof x);

output:

let x="10"
[Link](typeof x);
output

let x="Kumar Nishant"


[Link](typeof x);

output

let x=10.23
[Link](typeof x);
Output:

let x=true;
[Link](typeof x);

output
let x;
[Link](typeof x);

output

let student={name:'kumar' ,city:'Mumbai'};


[Link](typeof student);

output

let student=['kumar','nishant','Ramesh']
[Link](typeof student);

output
JavaScript Types are Dynamic
JavaScript has dynamic types. This means that the same variable can be
used to hold different data types:

Example:

let x=10;
[Link](x);
x='kumar';
[Link](x);

output:

let x="Hello how are You Kumar?";


[Link](x);
let y="Hello how are you 'Kumar'";
[Link](y);
let z='Hello how are your "Kumar"';
[Link](z);
output:

let x=BigInt("9874563214569877");
[Link](typeof x);

output

let x='Nishant'+10;
[Link](x);

output:

let x='Nishant'+10+20;
[Link](x);
let x=10+20+'Nishant';
[Link](x);

output:

let x=null;
[Link](x);

[Link](typeof x);

output:
const s=Symbol();
[Link](typeof s);

output:

const s=Symbol('hello');
[Link]([Link]);

output

You might also like