-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatatype.js
36 lines (28 loc) · 1.31 KB
/
datatype.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Type Of Datatype
// What
// - Data types in JavaScript are the different types of values that can be stored and manipulated in a program.
// - They define the kind of data that a variable can hold and the operations that can be performed on that data.
// Why
// - Data types help ensure that your program behaves correctly and handles different types of data appropriately.
// - They provide a foundation for writing robust and maintainable code.
// How
// - JavaScript has a set of built-in data types that define the kind of values that can be stored and manipulated in a program. These data types include:
// - Number: Represents numeric values, including integers and floating-point numbers.
// - String: Represents textual data, enclosed in quotes.
// - Boolean: Represents logical values, which can be either true or false.
// - Object: Represents complex data structures, such as arrays, functions, and custom objects.
// - Undefined: Represents a variable that has not been assigned a value.
// - Null: Represents a variable that has been explicitly assigned a value of null.
// Non-Primitive Data Types (Reference, Complex)
// Object
const object = {
key1: "value1",
key2: "value2",
key3: "value3",
};
// Array
const array = [1, 2, 3, 4, 5];
// Function
function myFunction(parameter) {
return parameter;
}