|
|
|
<!doctype html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<title>My Learning Website</title>
|
|
|
|
<link href="/styles/styles.css" rel="stylesheet" type="text/css">
|
|
|
|
<link href="/webdevelopment/styles/styles.css" rel="stylesheet" type="text/css">
|
|
|
|
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
|
|
|
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
|
|
|
<!--[if lt IE 9]>
|
|
|
|
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
|
|
|
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
|
|
|
<![endif]-->
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<h1 class="courselink">JavaScript Essential Training</h1>
|
|
|
|
<h2 class="lecturer">LinkedIn Learning : Morten Rand-Hendriksen</h2>
|
|
|
|
<h1 class="episodetitle">Code Samples</h1>
|
|
|
|
|
|
|
|
<article>
|
|
|
|
<h2 class="sectiontitle">Object Constructor Function</h2>
|
|
|
|
<p>This is the code for creating an object using the a simple object declaration.</p>
|
|
|
|
<pre class="codesample">
|
|
|
|
/**
|
|
|
|
* Create a Backpack object.
|
|
|
|
*/
|
|
|
|
|
|
|
|
const backpack = {
|
|
|
|
name: "Everyday Backpack",
|
|
|
|
volume: 30,
|
|
|
|
color: "grey",
|
|
|
|
pocketNum: 15,
|
|
|
|
strapLength: {
|
|
|
|
left: 26,
|
|
|
|
right: 26,
|
|
|
|
},
|
|
|
|
lidOpen: false,
|
|
|
|
toggleLid: function (lidStatus) {
|
|
|
|
this.lidOpen = lidStatus;
|
|
|
|
},
|
|
|
|
newStrapLength: function (lengthLeft, lengthRight) {
|
|
|
|
this.strapLength.left = lengthLeft;
|
|
|
|
this.strapLength.right = lengthRight;
|
|
|
|
},
|
|
|
|
};</pre>
|
|
|
|
</article>
|
|
|
|
|
|
|
|
<div class="btngroup">
|
|
|
|
<button class="button" onclick="window.location.href='javascriptessentialtraining2021.html'">
|
|
|
|
Course Contents
|
|
|
|
</button>
|
|
|
|
<button class="button" onclick="window.location.href='/webdevelopment/webdevelopment.html'">
|
|
|
|
Web Development Page
|
|
|
|
</button>
|
|
|
|
<button class="button" onclick="window.location.href='/index.html'">
|
|
|
|
Home
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|