-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.html
More file actions
276 lines (216 loc) · 10.6 KB
/
data.html
File metadata and controls
276 lines (216 loc) · 10.6 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
<!DOCTYPE html>
<html xmlns= xml:lang="en-US" lang="en-US">
<!--<![endif]-->
<head>
<!-- Basic Page Needs -->
<meta charset="utf-8">
<title>Functions in JavaScript</title>
<meta name="description" contect="A visual representation of Javascript variables, funtions and loops. This lesson is functions"
<!-- Mobile Specific Metas -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!-- Bootstrap -->
<link rel="stylesheet" type="text/css" href="stylesheets/bootstrap.css">
<!-- Theme Style -->
<link rel="stylesheet" type="text/css" href="stylesheets/style.css">
<!-- Responsive -->
<link rel="stylesheet" type="text/css" href="stylesheets/responsive.css">
<!-- Colors -->
<link rel="stylesheet" type="text/css" href="stylesheets/colors/color1.css" id="colors">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.0/themes/prism.min.css" />
<!-- Favicon and touch icons -->
<link href="icon/apple-touch-icon-48-precomposed.png" rel="apple-touch-icon-precomposed" sizes="48x48">
<link href="icon/apple-touch-icon-32-precomposed.png" rel="apple-touch-icon-precomposed">
<link href="icon/favicon.ico" rel="shortcut icon">
<style>
code[class*=language-],
pre[class*=language-] {
white-space: pre-line;
word-wrap: break-word;
}
</style>
<!--[if lt IE 9]>
<script src="javascript/html5shiv.js"></script>
<script src="javascript/respond.min.js"></script>
<![endif]-->
</head>
<body class="header-sticky">
<!-- Header -->
<header id="header" class="header clearfix" style="margin-bottom: 20px;">
<div class="container">
<div class="row">
<div class="col-md-6">
<div class="header-wrap clearfix">
<div id="logo" class="logo">
<a href="index.html" rel="home">
<img src="images/video/script.jpg" style="width: 20%" alt="sesame script logo">
</a>
</div><!-- /.logo -->
</div>
</div>
<div class="col-md-6">
<div class="page-title-heading">
<h1 class="title" style="font-size: 3em;">Datatypes in Javascript</h1>
</div><!-- /.page-title-captions -->
</div><!-- /.col-md-12 -->
</div><!-- /.row -->
</div><!-- /.container -->
</div><!-- /.page-title -->
</header><!-- /.header -->
<!-- Blog single -->
<section class="blog blog-single without-sidebar">
<div class="container">
<div class="row">
<div class="col-md-12">
</div>
<div class="col-md-12">
<div class="post-wrap">
<article class="entry">
<div class="entry-wrapper">
<div class="entry-content">
<p> Strings: A string (or a text string) is a series of characters like "John Doe".
Strings are written with quotes. You can use single or double quotes:</p>
<pre><code class="language-javascript" style="width: 100%;">var carName1 = "Volvo XC60"; // Using double quotes
var carName2 = 'Volvo XC60'; // Using single quotes
</code></pre>
<p> Numbers: JavaScript has only one type of numbers.
Numbers can be written with, or without decimals.</p>
<pre><code class="language-javascript" style="width: 100%;">
var x1 = 34.00; // Written with decimals
var x2 = 34; // Written without decimals
</code></pre>
<p> Booleans: Booleans can only have two values: true or false.</p>
<pre><code class="language-javascript" style="width: 100%;">
var x = 5;
var y = 5;
var z = 6;
(x == y) // Returns true
(x == z) // Returns false
</code></pre>
<p> Arrays: JavaScript arrays are written with square brackets.
Array items are separated by commas.
The following code declares (creates) an array called cars, containing three items (car names):
</p>
<pre><code class="language-javascript" style="width: 100%;">
var cars = ["Saab", "Volvo", "BMW"];
</code></pre>
<p> Objects: JavaScript objects are written with curly braces {}.
Object properties are written as name:value pairs, separated by commas.</p>
<pre><code class="language-javascript" style="width: 100%;">
var person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"};
</code></pre>
<p> The typeof Operator:You can use the JavaScript typeof operator to find the type of a JavaScript variable.
The typeof operator returns the type of a variable or an expression.</p>
<pre><code class="language-javascript" style="width: 100%;">
typeof "" // Returns "string"
typeof "John" // Returns "string"
typeof "John Doe" // Returns "string"
typeof 0 // Returns "number"
typeof 314 // Returns "number"
typeof 3.14 // Returns "number"
typeof (3) // Returns "number"
typeof (3 + 4) // Returns "number"
</code></pre>
<p>Undefined:
A variable without a value, has the value undefined. The type is also undefined.
Any variable can be emptied, by setting the value to undefined. The type will also be undefined.</p>
<pre><code class="language-javascript" style="width: 100%;">
var car; // Value is undefined, type is undefined
car = undefined; // Value is undefined, type is undefined
</code></pre>
<p>Empty Values:
An empty value has nothing to do with undefined.
An empty string has both a legal value and a type.</p>
<pre><code class="language-javascript" style="width: 100%;">
var car; // Value is undefined, type is undefined
</code></pre>
<p>Null:
In JavaScript null is "nothing". It is supposed to be something that doesn't exist.
Unfortunately, in JavaScript, the data type of null is an object.
You can consider it a bug in JavaScript that typeof null is an object. It should be null.
You can empty an object by setting it to null:You can also empty an object by setting it to undefined.</p>
<pre><code class="language-javascript" style="width: 100%;">
var person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"};
person = null; // Now value is null, but type is still an object
var person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"};
person = undefined; // Now both value and type is undefined
</code></pre>
<p>Difference Between Undefined and Null
undefined and null are equal in value but different in type:</p><pre><code class="language-javascript" style="width: 100%;">
typeof undefined // undefined
typeof null // object
null === undefined // false
null == undefined // true
</code></pre>
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/DHjib4ngZd4"></iframe>
</div>
<p><span class="dropcap">J </span>avaScript
variables can hold many data types: numbers, strings, booleabs, arrays, objects and more:
To be able to operate on variables, it is important to know something about the type.
</p>
</div><!-- /entry-content -->
</div>
</article><!-- /.entry -->
</div><!-- /.post-wrap -->
</div>
</div><!-- /.row -->
</div><!-- /.container -->
</section>
</div><!-- /.site-wrapper -->
<!-- Canvas -->
<div class="flat-footer">
<div class="footer-widgets">
<div class="container">
<div class="row">
<div class="col-md-12">
<div id="text-3" class="widget widget_text">
<div class="textwidget">
<img src="images/video/script.jpg" style="width: 10%;" alt="Sesame Script Logo">
</div>
</div>
</div>
</div><!-- /.row -->
</div><!-- /.container -->
</div><!-- /#page-footer -->
<div class="footer-content">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="social-links">
<a href="https://linkedin.com/in/katharrislink"><i class="fa fa-linkedin"></i></a>
<a href="https://github.com/katophelix"><i class="fa fa-github"></i></a>
<a href="mailto:katharrismail@gmail.com"><i class="fa fa-envelope"></i>
<a href="https://katophelix.github.io/resume/"><i class="fa fa-laptop"></i></a>
<a href=" https://www.youtube.com/channel/UCrO9ZWdhs-jQrMg1b_eng1g"><i class="fa fa-youtube"></i></a>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
</div>
</div>
<div class="col-md-12">
<div class="copyright">
<div class="copyright-content">Sesame Script <span>•</span> Kat Harris<br>
</div><!-- /.copyright-content -->
</div><!-- /.copyright -->
</div>
</div> <!-- /.row -->
</div><!-- /.container -->
</div>
<!-- Go Top -->
<a class="go-top">
</a>
<!-- Javascript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.0/prism.min.js"></script>
<script type="text/javascript" src="javascript/jquery.min.js"></script>
<script type="text/javascript" src="javascript/bootstrap.min.js"></script>
<script type="text/javascript" src="javascript/owl.carousel.js"></script>
<script type="text/javascript" src="javascript/jquery.flexslider-min.js"></script>
<script type="text/javascript" src="javascript/jquery.magnific-popup.min.js"></script>
<script type="text/javascript" src="javascript/jquery.easing.js"></script>
<script type="text/javascript" src="javascript/parallax.js"></script>
<script type="text/javascript" src="javascript/jquery.cookie.js"></script>
<script type="text/javascript" src="javascript/main.js"></script>
</body>
</html>