Skip to content

Commit 4a0170d

Browse files
feat: add data-type Symbol
1 parent cb5bbea commit 4a0170d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

part1 (Basics)/02_datatypes.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ console.log(user); // { firstName: "whoami", lastName: "dsnake0" }
5555
let uniqueId = Symbol("id");
5656
console.log(uniqueId); // Symbol(id)
5757

58+
const id = Symbol("id");
59+
const person = {
60+
name: "Rafay",
61+
[id]: 123,
62+
};
63+
console.log(person[id]); // 123
64+
5865
// INFO: Type of each DataTypes
5966

6067
console.log(typeof name); // "string"

0 commit comments

Comments
 (0)