forked from pearlchen/LLC-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathjs_functions.html
More file actions
720 lines (614 loc) · 24.9 KB
/
js_functions.html
File metadata and controls
720 lines (614 loc) · 24.9 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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ladies Learning Code - Intro to JavaScript</title>
<meta name="viewport" content="width=1280">
<!-- CoderDeck core and extension CSS files -->
<link rel="stylesheet" href="src/deck.js/core/deck.core.css" type="text/css">
<link rel="stylesheet" href="src/deck.js/extensions/navigation/deck.navigation.css">
<link rel="stylesheet" href="src/deck.js/extensions/status/deck.status.css">
<link rel="stylesheet" href="src/deck.js/extensions/hash/deck.hash.css">
<link rel="stylesheet" href="src/deck.js/extensions/menu/deck.menu.css">
<link rel="stylesheet" href="src/css/prettify.css">
<link rel="stylesheet" href="src/css/deck.coder.css">
<link rel="stylesheet" href="src/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="src/codemirror/theme/default.css">
<!-- Custom for LLC -->
<link href='http://fonts.googleapis.com/css?family=Istok+Web' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Podkova' rel='stylesheet' type='text/css'>
<link rel="stylesheet" id='style-theme-link' href="src/css/coderdeck.css" type="text/css" >
<style type="text/css"></style>
</head>
<body class="deck-container">
<script type='text/coderdeck' id='coderdeck-default'>
<html>
<head>
<script src='src/jquery.min.js'>SCRIPTEND</head>
<body>CODE</body>
</html>
</script>
<script type='text/coderdeck' id='coderdeck-style-example'>
<html>
<title>test</title>
<style>CODE</style>
<body>
</body>
</html>
</script>
<div id="presentation">
<!-- **************************************** -->
<!-- SLIDE: JS THEORY Part 2 -->
<article class='slide slide-subhead'>
<h1>JavaScript Part 2</h1>
<p>Functions</p>
</article>
<!-- SLIDE: FUNCTIONS -->
<article class='slide slide-list'>
<h2>Functions in JavaScript</h2>
<br />
<p>Remember, <span class="keyword">functions</span> are used to make the code "do things." It is especially useful for repetitive tasks.</p>
<p>
<code>prompt()</code>
and
<code>alert()</code>
are two functions that are pre-written into JavaScript.
</p>
<p>But sometimes you need to group tasks that aren't covered by one of the pre-written functions.</p>
<p>That's when we create our own!</p>
</article>
<!-- SLIDE: DEFINING FUNCTIONS -->
<article class='slide slide-list'>
<h2>Defining a Function</h2>
<p>
To create a function, it needs to be <strong>defined</strong>
first.
</p>
<p>
There are different ways to define a function, but the most common way is using the
<code>function</code> <em>keyword</em>.
</p>
<p>
The keyword is followed by the function <strong class="keyword">name</strong>, of your choosing, and round brackets <code>()</code>. And finally, the code to be executed are enclosed within curly braces <code>{ }</code>.
</p>
<pre class='prettyprint'>
function nameOfFunction() {
//code to execute
}
</pre>
</article>
<!-- SLIDE: CALLING FUNCTIONS -->
<article class='slide slide-list'>
<h2>Calling a Function</h2>
<p>Let's define a function called <code>sayMyName</code> and use <code>alert()</code> to get the computer to "say" our names. The code within a function doesn't execute until it's <span class="keyword">called</span>.</p>
<p>Functions can also be used inside other functions too.</p>
<div class="hint single-line">
<p>We've seen functions being called already!</p>
</div>
<br />
<textarea class='coder-editor coder-editor-full'><script>
//Define the function
//Call the function
</script></textarea>
<script type="coder-solution">SCRIPT
//Define the function
function sayMyName() {
alert("Brenna");
}
//Call the function
sayMyName();
SCRIPTEND</script>
<br />
<pre class="prettyprint sidenote">
//Here's the syntax again
function nameOfFunction() {
code to execute
}
</pre>
</article>
<!-- SLIDE: CALLING FUNCTIONS FROM EVENTS -->
<article class='slide slide-list'>
<h2>Functions & Events</h2>
<p>
The browser executes the JavaScript as soon as the page loads.
</p>
<p>
But sometimes you need to control when it executes, like when someone rolls over a navigation item or presses a submit button. These are referred to as an <span class="keyword">events</span>.
</p>
<p>In other words, functions can be used to execute events.</p>
<textarea class='coder-editor coder-editor-full'>
<script>
//define function
function sayMyName() {
alert("Brenna");
}
</script>
<!-- call function from a button click -->
<input type="button" value="Say my name!" >
</textarea>
<script type="coder-solution">SCRIPT
//define function
function sayMyName() {
alert("Brenna");
}
SCRIPTEND
<!-- call function from a button click -->
<input type="button" value="Say my name!" onclick="sayMyName();" >
</script>
<br />
<p class="sidenote">Note: You can use <code>onclick()</code> on any HTML element</p>
<pre class="prettyprint sidenote">
<div onclick="sayMyName();">
Click here to call the function!
</div>
</pre>
</p>
</article>
<!-- SLIDE: "LIKE" BUTTON -->
<article class='slide slide-list'>
<h2>Who loves Ladies Learning Code?</h2>
<p>Run it and see what happens!</p>
<textarea class='coder-editor coder-editor-full'>
<link rel="stylesheet" type="text/css" href="exercises/slides.css">
SCRIPT
//declaring the variable
var loves = 0;
//defining the function
function moreLove(){
//re-assigning the value of the love variable
loves = loves + 1;
//this updates the number count
document.getElementById('update').innerHTML = loves;
}
SCRIPTEND
<div id="loveLLC">
<button onclick="moreLove();"><!-- calling the function -->
<img src="exercises/assets/llc-logo.png" /> Love!
</button>
<p id="update">0</p>
</div>
</textarea>
</article>
<!-- SLIDE: MINI-EXERCISE #2 - ADD/REMOVE ITEMS - ONE PRODUCT -->
<article class='slide slide-list'>
<h2><div class="smaller">Mini-exercise (5-10 minutes):</div>
Quantities</h2>
<p>Let's create a one-product shopping page where you can update the<br />
quantity by adding or removing it from the shopping cart.</p>
<p class="centered">Here's what it should look like:<br />
<img src="exercises/assets/android-quantity.png" alt="android-quantity" width="225" height="282" /></p>
</article>
<!-- SLIDE: MINI-EXERCISE #2 : Code page -->
<article class='slide slide-list'>
<h2><div class="smaller">Mini-exercise (5-10 minutes):</div>
Quantities</h2>
<p>Use the <code>quantity</code> variable to keep track of additions and subtractions to the running total.</p>
<div class="hint">
<p>1. The "Add" and "Remove" buttons haven't been clicked yet so <code>quantity</code> needs to be initialized to a default value first. Replace the asterix with your answer.<br/>
2. Use your knowledge of arithemetic operators and variable assignment to re-calculate the value of <code>quantity</code>.<br />
3. Same as step 2 above.</p>
</div>
<textarea class='coder-editor coder-editor-full'>
<script>
/* 1. Set 'quantity' to start at 0. This will be used
to hold the value for the quantity of ordered robots */
var quantity;
//quantity = ********
// CODE BETWEEN THE CURLY BRACES BELOW WILL EXECUTE
// EACH TIME YOU PRESS THE 'ADD' BUTTON
function addItem() {
/* 2. Set the variable 'quantity' to INCREASE by 1: */
//quantity = ********
refreshTotal(); //Updates the total, no need to edit.
}
// CODE BETWEEN THE CURLY BRACES BELOW WILL EXECUTE
// EACH TIME YOU PRESS THE 'REMOVE' BUTTON
function removeItem() {
/* 3. Set the variable 'quantity' to DECREASE by 1: */
//quantity = ********
refreshTotal();
}
// CODE BETWEEN THE CURLY BRACES BELOW WILL EXECUTE
// ON DEMAND, IN ORDER TO UPDATE THE HTML TEXT FIELD
function refreshTotal() {
document.getElementById('updateQuantity').value = quantity;
}
</script>
<link rel="stylesheet" href="exercises/slides.css" type="text/css" />
<div class="item">
<img src="http://brennaobrien.com/LLC-JavaScript/exercises/assets/plush-android.jpg" width="195" height="195" />
<br />
<button onclick="addItem();">Add</button>
<button onclick="removeItem();">Remove</button>
<br />
Quantity
<input type="text" id="updateQuantity" value="0" readonly />
<br />
</div>
</textarea>
<p class="solution-link">If you get stuck, <a href="exercises/solutions/quantities.txt" target="_blank">click here</a> for the full solution.<br />Or if you want to reset, <a href="exercises/solutions/quantities-org.txt" target="_blank">click here</a> for the original code.</p>
</article>
<!-- SLIDE: FUNCTIONS IN SHOPPING CART EXAMPLE -->
<article class='slide slide-list'>
<h2>Functions in Functions</h2>
<p>
Let's take a closer look at our functions.
</p>
<pre class="prettyprint">
<script>
var quantity = 0;
function <strong>addItem()</strong> {
quantity = quantity + 1;
<strong>refreshTotal()</strong>;
}
function <strong>removeItem()</strong>{
quantity = quantity - 1;
<strong>refreshTotal()</strong>;
}
function <strong>refreshTotal()</strong> {
document.getElementById('updateQuantity').value = quantity;
}
</script>
<!-- HTML and CSS -->
<link rel="stylesheet" href="http://brennaobrien.com/LLC-JavaScript/exercises/slides.css" type="text/css" media="screen" />
<div class="item">
<img src="http://brennaobrien.com/LLC-JavaScript/exercises/assets/plush-android.jpg" width="195" height="195" />
<br />
<button onclick="<strong>addItem()</strong>;">Add</button>
<button onclick="<strong>removeItem()</strong>;">Remove</button>
<br />
Quantity
<input type="text" id="updateQuantity" value="0" readonly />
<br />
<br />
Total Cost:
<input type="text" id="updateTotal" value="0" readonly />
</div>
</pre>
</article>
<!-- SLIDE: Mini-exercise -->
<article class='slide slide-list'>
<h2><div class="smaller">Mini-exercise (5-10 minutes):</div>
Quantities and Total Cost</h2>
<p>Let's re-visit the Quantities exercise and add a text field to show the total cost. If the Android plushie cost $20 <strong>each</strong>, how do we calculate the <strong>total cost</strong>? </p>
<textarea class='coder-editor coder-editor-full'>SCRIPT
var quantity = 0;
function addItem(){
quantity = quantity + 1;
refreshTotal();
}
function removeItem(){
quantity = quantity - 1;
refreshTotal();
}
function refreshTotal() {
// This line will update the quantity HTML text field
document.getElementById('updateQuantity').value = quantity;
/* TODO: upate the totalCost variable to calculate
the price based on quantity */
//var totalCost = ********
document.getElementById('updateTotal').value = totalCost;
/* BONUS: Use concatenation to add a human readable
$ sign to the totalCost: */
//var totalCostToShow = ********
document.getElementById('updateTotal').value = totalCostToShow;
}
SCRIPTEND
<link rel="stylesheet" href="exercises/slides.css" type="text/css" media="screen" />
<div class="item">
<img src="http://brennaobrien.com/LLC-JavaScript/exercises/assets/plush-android.jpg" width="195" height="195" /><br />
<div id="price">$20 each</div>
<button onclick="addItem();">Add</button>
<button onclick="removeItem();">Remove</button><br />
Quantity
<input type="text" id="updateQuantity" value="0" readonly /><br />
Total Cost:
<input type="text" id="updateTotal" value="0" readonly />
</div>
</textarea>
<script type='coder-solution'>SCRIPT
var quantity = 0;
function addItem(){
quantity = quantity + 1;
refreshTotal();
}
function removeItem(){
quantity = quantity - 1;
refreshTotal();
}
function refreshTotal() {
// This line will update the quanity HTML textfield
document.getElementById('updateQuantity').value = quantity;
/* CURRENT: The total cost HTML textfield displays only a number right now */
var totalCost = quantity * 20; //fixed price of $20
//document.getElementById('updateTotal').value = totalCost;
/* TODO: Use concatenation to add a human readable $ sign to the totalCost: */
var totalCostToShow = "$" + totalCost;
document.getElementById('updateTotal').value = totalCostToShow;
}
SCRIPTEND
<link rel="stylesheet" href="exercises/slides.css" type="text/css" media="screen" />
<div class="item">
<img src="http://brennaobrien.com/LLC-JavaScript/exercises/assets/plush-android.jpg" width="195" height="195" /><br />
<div id="price">$20 each</div>
<button onclick="addItem();">Add</button>
<button onclick="removeItem();">Remove</button><br />
Quantity
<input type="text" id="updateQuantity" value="0" readonly /><br />
Total Cost:
<input type="text" id="updateTotal" value="0" readonly />
</div>
</script>
</article>
<!-- SLIDE: REVIEW: FUNCTIONS -->
<article class='slide slide-list'>
<h2>Review: What do we know about Functions so far?</h2>
<br />
<p><strong>›</strong> Created & defined by using the <code>function</code> keyword</p>
<p><strong>›</strong> Used to group together related lines of code and store them into descriptive names</p>
<p><strong>›</strong> Can be reused just by calling the function name</p>
<p><strong>›</strong> <strong>Define</strong> the function first but it will not run until you <strong>call</strong> the function</p>
<p><strong>›</strong> Can be used inside another function</p>
</article>
<!-- SLIDE: FUNCTIONS PIZZA #1 -->
<article class='slide slide-list'>
<h2>Functions and Pizza</h2>
<p>
Let's order a pizza! The <strong><code>orderPizza()</code></strong> function below represents all the steps it takes to place an order (find the pizza place's phone number, call them, give them your address, etc).
</p>
<p>
Inside the function is where the pizza restaurant will hold our options choices (toppings, crust type and size of pizza). Now they can use this stored information to make our order.
</p>
<textarea class='coder-editor coder-editor-full'>
<script>
function orderPizza() {
var topping = "cheese";
var crust = "thin crust";
var size = "medium";
document.write("Pizza order:<br />" + topping + ", " + crust + ", " + size);
}
orderPizza();
</script></textarea>
</article>
<!-- SLIDE: FUNCTIONS PIZZA #2 -->
<article class='slide slide-list'>
<h2>More Pizza!</h2>
<p>
What if we want to order another pizza but with different options?
<br />
Let's order another pizza by creating another function.
</p>
<textarea class='coder-editor coder-editor-full'>
<script>
// original orderPizza:
function orderPizza() {
var topping = "cheese";
var crust = "thin crust";
var size = "medium";
document.write("Pizza order:<br />" + topping + ", " + crust + ", " + size);
}
orderPizza();
// an edited copy of orderPizza...
</script></textarea>
<script type="coder-solution">SCRIPT
// original orderPizza:
function orderPizza() {
var topping = "cheese";
var crust = "thin crust";
var size = "medium";
document.write("Pizza order:<br />" + topping + ", " + crust + ", " + size + "<br />");
}
orderPizza();
// an edited copy of orderPizza...
function orderAnotherPizza() {
var topping = "pepperoni";
var crust = "stuffed crust";
var size = "small";
document.write("Pizza order:<br />" + topping + ", " + crust + ", " + size);
}
orderAnotherPizza();
SCRIPTEND</script>
</article>
<!-- SLIDE: FUNCTIONS PIZZA - GLOBAL VS LOCAL -->
<article class='slide slide-list'>
<h2>Global vs Local Variables</h2>
<p>
Let's say the pizza place always want to include cheese as a basic topping in all of the pizzas. We can declare a
<strong><code>baseTopping</code></strong>
variable outside of the function so it can be accessible from anywhere in the program.
</p>
<textarea class='coder-editor coder-editor-full'>
<script>
function orderPizza() {
var topping = "bacon";
var crust = "thin crust";
var size = "medium";
document.write("Pizza order:<br />" + topping + ", " + crust + ", " + size + "<br /><br />");
}
function orderAnotherPizza() {
var topping = "pepperoni";
var crust = "stuffed crust";
var size = "small";
document.write("Pizza order:<br />" + topping + ", " + crust + ", " + size);
}
orderPizza();
orderAnotherPizza();
</script></textarea>
<script type="coder-solution">SCRIPT
var baseTopping = "cheese";
function orderPizza() {
var topping = "bacon";
var crust = "thin crust";
var size = "medium";
document.write("Pizza order:<br />" + baseTopping
+ "<br />" + topping + ", " + crust + ", " + size + "<br /><br />");
}
function orderAnotherPizza() {
var topping = "pepperoni";
var crust = "stuffed crust";
var size = "small";
document.write("Pizza order:<br />" + baseTopping
+ "<br />" + topping + ", " + crust + ", " + size);
}
orderPizza();
orderAnotherPizza();
SCRIPTEND</script>
</article>
<article class='slide slide-list'>
<h2>Functions, Pizza and Parameters</h2>
<p>
This could get cumbersome if we wanted to make a lot of pizzas. How can we re-use the <code>makePizza()</code> function instead of creating multiple functions? We use <span class="keyword">parameters</span>.
</p>
<p>
Functions can be used with one parameter, more than one parameter or none at all.
</p>
<textarea class='coder-editor coder-editor-full'>
<script>
var baseTopping = "cheese";
function orderPizza() {
var topping = "bacon";
var crust = "thin crust";
var size = "medium";
document.write("Pizza order:<br />" + baseTopping
+ "<br />" + topping + ", " + crust + ", " + size + "<br /><br />");
}
function orderAnotherPizza() {
var topping = "pepperoni";
var crust = "stuffed crust";
var size = "small";
document.write("Pizza order:<br />" + baseTopping
+ "<br />" + topping + ", " + crust + ", " + size);
}
orderPizza();
orderAnotherPizza();
</script>
</textarea>
<script type='coder-solution'>
SCRIPT
var baseTopping = "cheese";
function orderPizza(topping, crust, size) {
document.write("Pizza order:<br />" + baseTopping
+ "<br />" + topping + ", " + crust + ", " + size + "<br /><br />");
}
orderPizza("pepperoni", "thin crust", "medium");
orderPizza("mushrooms", "stuffed crust", "large");
orderPizza("chicken", "regular crust", "small");
SCRIPTEND
</script>
</article>
<!-- SLIDE: Functions & Parameters Review -->
<article class='slide slide-list'>
<h2>Review: Functions and Parameters</h2>
<p>Functions are more flexible when used with parameters because variables can be <strong>passed</strong> into the function.</p>
<p>In the <code>makePizza()</code> function, the variables from inside the function were removed and added as parameters. Now when we <em>call</em> the function we can <em>pass</em> the values right into the function.</p>
<img src="assets/function-parameters.jpg" alt="function-parameters" width="800" height="469" />
</article>
<article class='slide slide-list'>
<h2>Inline JavaScript</h2>
<p>
JavaScript can appear
<strong>inline</strong>
in a webpage in several spots. Either in the
<code><head></code>
section or anywhere in the
<code><body></code>
section.
</p>
<pre class="prettyprint">
<html>
<head>
<title>JavaScript example!</title>
<strong><script type="text/javascript">
alert("I'm in the head tag!");
</script></strong>
</head>
<body>
<div id="example">This is an example.</div>
<strong><script type="text/javascript">
alert("I'm in the body tag!");
</script></strong>
</body>
</html>
</pre>
<div class="reminders">
<p>Need to manipulate an html tag or have a quick loading page? Put the JavaScript just before the
<strong>closing</strong>
<code><body></code>
tag.</p>
</div>
</article>
<!-- SLIDE: Code Editor -->
<article class='slide slide-list'>
<h2>Using a Code Editor</h2>
<p>Go to the <code>exercises</code> folder and open up <code><a href="http://brennaobrien.com/LLC-JavaScript/exercises/pizzaMaking.html" target="_blank">pizzaMaking.html</a></code><br>
<span class="sidenote">(Psst: It's also in the ZIP folder that you downloaded earlier today.)</span> </p>
<div class="centered contains_sidebyside_icons">
<a href="http://www.sublimetext.com" target="_blank"><img src="assets/SublimeTextIcon.jpg" width="125" height="125" alt="Sublime Text 2" /></a>
<br />
<a href="http://www.sublimetext.com/" target="_blank">Sublime Text</a>
</div>
<br clear="all" /><br>
<div class="reminders"><p>Most computers are set to open <code>.html</code> files in the default web browser so <strong>right-click</strong> (Command+click or 2-finger click on Mac) and select the "<strong>open with...</strong>" option.</p></div>
</article>
<!-- SLIDE: Code Editor -->
<article class='slide slide-list'>
<h2>Using a Code Editor</h2>
<p>Uh oh!</p>
<p>This is almost the same code as previous. Why isn't it making pizza? :(
<div class="show-hint" onclick="javascript:showHint('title-tag'); this.style.display = 'none';">Spoiler! Click here to show answer if you really can't find it...</div>
<div id="title-tag" class="hint-solution">On line 16, there is a double quote missing before <em>thin crust</em>.</div>
</p>
<br /><br />
<p class="reminders">
Take note of how your code is being coloured. It's the first sign of a possible syntax error and will save you headaches later.
<br>
<span class="sidenote">Some editors do a better job than others -- that's what you pay for sometimes.</span>
</p>
</article>
<article class='slide slide-list'>
<h2><div class="smaller">Mini-exercise (now until lunch)</div>
Wing machine</h2>
<p>1. Using <code>pizzaMaking.html</code> as an example, create a new .html file named <code>wingMaking.html</code>.
<p>2. Use inline JavaScript and write a new function that makes wings with these 3 variations:</p>
<ul>
<li>Style <span class="sidenote">e.g. crispy or regular</span></li>
<li>Spice Level <span class="sidenote">e.g. mild, medium, hot</span></li>
<li>Sauce <span class="sidenote">e.g. BBQ, honey mustard, buffalo, Thai</span></li>
</ul>
<p>3. Use <em>parameters</em> in a single function to create multiple types and flavours of wings easier -- versus writing multiple wing making functions.</p>
<p class="sidenote">If you're really stuck, go to the <code>solutions</code> folder and open up <code><a href="http://brennaobrien.com/LLC-JavaScript/exercises/solutions/wingMaking.html" target="_blank">wingMaking.html</a></code>
</article>
<!-- SLIDE: Next section -->
<article class='slide slide-list'>
<p class="centered vertically_centered"><a href="lunch_break.html"><img src="assets/next_section_icon.gif" width="230" height="70" alt="Click to go to next section" /></a></p>
</article>
<!-- **************************************** -->
</div>
<!-- END div id=presentation -->
<script src='src/jquery.min.js'></script>
<script src="src/modernizr.js"></script>
<!-- Update these paths to point to the correct files. -->
<script src="src/jquery.tmpl.min.js"></script>
<script src="src/deck.js/core/deck.core.js"></script>
<!-- Code Mirror -->
<script src="src/codemirror/lib/codemirror.js"></script>
<script src="src/codemirror/mode/xml/xml.js"></script>
<script src="src/codemirror/mode/css/css.js"></script>
<script src="src/codemirror/mode/javascript/javascript.js"></script>
<script src="src/codemirror/mode/htmlmixed/htmlmixed.js"></script>
<!-- Prettify -->
<script src="src/prettify.js"></script>
<!-- Deck Core and extensions -->
<script src="src/deck.js/extensions/status/deck.status.js"></script>
<script src="src/deck.js/extensions/navigation/deck.navigation.js"></script>
<script src='src/deck.coder.js'></script>
<script src="src/deck.js/extensions/hash/deck.hash.js"></script>
<script src="src/deck.js/extensions/menu/deck.menu.js"></script>
<script>
$(function() {
$.deck('.slide');
});
</script>
</body>
</html>