-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsymbols.html
44 lines (30 loc) · 1.05 KB
/
symbols.html
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
37
38
39
40
41
42
43
44
<!DOCTYPE html>
<html>
<head>
<!-- Load babel 5 - babel-core -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.38/browser.js"></script>
<script type="text/babel">
// Using factory method
const id = Symbol();
const courseInfo = {
title: "ES6",
topics: ["babel", "syntax", "functions", "classes"],
id: "js-course"
};
// If we define "id" as Symbol, it has unique id and won't be overrided.
courseInfo[id] = 19910819;
console.log(courseInfo);
</script>
<title>Symbols</title>
</head>
<body>
<h1>Hit the pit</h1>
<h2>Symbols</h2>
JavaScript Primitives are types, like numbers, strings, arrays and objects.
<ul>
<li>Symbols is a new type of primitive</li>
<li>Often used as unique IDs</li>
<li>Define customized iteration behavior</li>
</ul>
</body>
</html>