Skip to content

Commit 0fbc9de

Browse files
authored
Symbols in JS
1 parent e0e4cb1 commit 0fbc9de

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

symbols.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Symbols in JavaScript
2+
3+
// Defining Symbol 1
4+
const sym1 = Symbol();
5+
6+
// Defining Symbol 2
7+
const sym2 = Symbol();
8+
9+
// Checking whether the symbols are equal
10+
console.log(
11+
"Both 'sym1' and 'sym2' are undefined but they are not equal because symbols are always unique"
12+
);
13+
console.log(sym1 === sym2);

0 commit comments

Comments
 (0)