-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstructors.html
189 lines (150 loc) · 8.61 KB
/
constructors.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
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
<!DOCTYPE html>
<html xmlns= xml:lang="en-US" lang="en-US">
<head>
<!-- Basic Page Needs -->
<meta charset="utf-8">
<!--[if IE]><meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'><![endif]-->
<title>Javascript Constructors</title>
<meta name="description" contect="A visual representation of Javascript variables, funtions and loops. This lesson is constructors"
<!-- 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>
</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;">Constructors 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">
<pre><code class="language-javascript" style="width: 100%;">
function Person(first, last, age, eye) {
this.firstName = first;
this.lastName = last;
this.age = age;
this.eyeColor = eye;
}
</code></pre>
<div>
<img src="images/video/video.jpg">
</div>
<p><span class="dropcap">A </span> Constructor is a "blueprint" for creating many objects of the same "type".
The way to create an "object type", is to use an object constructor function.
In the example above, function Person() is an object constructor function.
In JavaScript, the thing called this is the object that "owns" the code.
The value of this, when used in an object, is the object itself.
In a constructor function this does not have a value. It is a substitute for the new object. The value of this will become the new object when a new object is created.
Note that this is not a variable. It is a keyword. You cannot change the value of this.
</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/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>