Skip to content

Commit 5750a3b

Browse files
committed
Stack and Heap memory in javascript
1 parent 16ac393 commit 5750a3b

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

01_Basic/dataype-summary.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,32 @@ Typeof use for different datatype and its output
6363

6464
// =>JavaScript is a dynamic language and not static,
6565
//which means that variables can hold values of different types during runtime.
66-
//Unlike languages such as Typescript or Java, you don’t need to declare the data type of a variable explicitly.
66+
//Unlike languages such as Typescript or Java, you don’t need to declare the data type of a variable explicitly.
67+
68+
69+
70+
// **********************=>Stack and Heap memory in javascript<=*****************************
71+
72+
// stack => primitive
73+
74+
let myname= "ankit"
75+
let anotherName = myname
76+
77+
anotherName = "rajesh"
78+
79+
console.log(myname);
80+
console.log(anotherName);
81+
82+
// Heap => Non-Primitive
83+
84+
let user1 = {
85+
86+
upi: "user@mpl"
87+
}
88+
89+
let user2 = user1
90+
91+
user2.email ="[email protected]"
92+
93+
console.log(user1);
94+
console.log(user2);

0 commit comments

Comments
 (0)