-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy path02-types-variables.html
73 lines (56 loc) · 1.25 KB
/
02-types-variables.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Getting Started with JavaScript</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<style>
body { padding: 30px; }
</style>
</head>
<body>
<!-- 🔥🔥🔥🔥 start javascript 🔥🔥🔥🔥 -->
<script>
// strings
'this is my string';
'my second string';
"my name is chris";
// numbers
10;
500;
3.14;
// booleans (truthy / falsy)
true;
false;
// specials
undefined;
null;
NaN;
// objects
const user = {
name: 'Chris',
username: 'chrisoncode'
};
// arrays
const users = ['chris', 'nick', 'holly'];
const luckyNumbers = [1, 43, 54, 132];
const whatever = ['chris', 1, 'holly'];
const superUsers = [
{ name: 'chris' },
{ name: 'nick' },
{ name: 'holly' }
];
console.log(superUsers[2].name);
// declaring variables
var thing = 'first';
const otherThing = {
name: 'chris'
};
let newThing = 'third';
otherThing.name = 'holly';
// ======================
let myVariable;
myVariable = 'something';
</script>
</body>
</html>