-
Notifications
You must be signed in to change notification settings - Fork 0
/
1. Front-End Web Dev.rtf
1745 lines (1333 loc) · 40.2 KB
/
1. Front-End Web Dev.rtf
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
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Lesson 2 : HTML Syntax
Quiz - Make Your First Element
<!--
This is a comment. Note the special tags. You can type whatever you want
in a comment. You can leave notes for yourself or other people with it.
-->
<!--
I want you to make three elements:
* One paragraph
* Two spans
Make sure you put some text content in every element!
When you're ready to test, click "Test run" button to see how your page looks.
When you're ready to submit, click "Submit" button to get feedback!
-->
<!--
Here's an example element:
<tag>content</tag>
-->
<html>
<p>para 1</p>
<span>span 1</span>
<span>span 2</span>
</html>
Quiz - Spot The Bug
Which Chunks of HTML are formatted incorrectly?
<p>a paragraph</p>
<span…middle of sentence…</span>
<p><em>words, words, wrods.</p></em>
Quiz - HTML Research
<p><b>This text should be bold.</b></p>
<p><em>And this text should have emphasis (italics).</em></p>
# Lesson 3 : HTML Syntax Problem Set
Quiz : Make all the Headers
headandshoulders
Quiz : Make a list
listlistlistlist
Quiz : Tree To HTML
letsclimbatree
Quiz : Constructing Links
<a href="https://www.google.com">Google</a>
Quiz : Add an Image
<!--
Sample image element:
<img src="http://somewebsite.com/image.jpg" alt="short description">
How to complete this quiz:
* Create an image element at the designated spot in the paragraph below.
* Set the source to: http://udacity.github.io/fend/images/udacity.png
* Set the alt description to a quick description of the image (maybe something like, "Udacity logo").
* Play around with the URL! See if you can make a different image appear.
-->
<p>
<img src="http://udacity.github.io/fend/images/udacity.png" alt="Udacity Logo">
This is a big paragraph of text about Udacity. Cool. Cool. And here is an image! <!-- put the image element here! --> Here's another question for you: how is the text reacting to the image? Is the image on its own line or is it showing up in the same last as the rest of the text?
</p>
Quiz : Figures
arenttreescool?
# Lesson 5 : CSS Syntax
Quiz : CSS or HTML?
3
Quiz : CSS Syntax
<!DOCTYPE html>
<!-- Instructions: Change the color of "Hello, world!" to green. -->
<html>
<head>
<title>Quiz - Hello, world!</title>
<style>
h1{
color:green;
}
p {
color: blue;
}
/* add CSS here */
</style>
</head>
<body>
<h1>Hello, world!</h1>
<p>Are you ready for your first challenge?</p>
<p>Let's add some style to this webpage!</p>
</body>
</html>
Quiz : Tag Selectors
All Paragraphs
Quiz : Using Selectors
<div class="right"></div>
<p class="highlight module right"></p>
Quiz : Using CSS References
font-style
text-decoration
text-transform
font-weight
Quiz : Units in CSS
<!DOCTYPE html>
<!-- Instructions: Add the following changes to this webpage:
* set the first div's width to 100px (pixels)
* set the second div's height to 200px (pixels)
* set the third div's margin to 1em
* set the fourth div's font-size to 2em
-->
<html>
<head>
<title>Quiz - Units in CSS</title>
<style>
.first {
width:100px;
/* add CSS here */
}
.second {
height:200px;
/* add CSS here */
}
.third {
margin:1em;
/* add CSS here */
}
.fourth {
font-size:2em;
/* add CSS here */
}
</style>
</head>
<body>
<div class="first"></div>
<div class="second"></div>
<div class="third">Hammock ex plaid nulla. Nihil stumptown gastropub, dreamcatcher gochujang franzen cillum cliche keffiyeh pop-up pug small batch knausgaard. Fanny pack elit you probably haven't heard of them before they sold out. Sint elit tofu et veniam irony 3 wolf moon. VHS slow-carb trust fund chartreuse wolf. Qui sed dreamcatcher cronut, hoodie fixie normcore. Gochujang dolor consectetur post-ironic.</div>
<div class="fourth">Hammock ex plaid nulla. Nihil stumptown gastropub, dreamcatcher gochujang franzen cillum cliche keffiyeh pop-up pug small batch knausgaard. Fanny pack elit you probably haven't heard of them before they sold out. Sint elit tofu et veniam irony 3 wolf moon. VHS slow-carb trust fund chartreuse wolf. Qui sed dreamcatcher cronut, hoodie fixie normcore. Gochujang dolor consectetur post-ironic.</div>
</body>
</html>
Quiz : Identifying Colors
color : blue;
color : rgb(0 ,0 ,255);
color : 300f;
# Lesson 6 : CSS Syntax Problem Set
Quiz : Style an Image
<!DOCTYPE html>
<!-- Instructions: Replicate the same styling seen in the kitten image below. -->
<html>
<head>
<title>Style an Image Quiz</title>
<style>
.kitten-image {
border: dashed red;
/* add CSS here */
}
</style>
</head>
<body>
<!-- Image credit: Nicolas Suzor, https://www.flickr.com/photos/nicsuzor/ - via Flickr, Creative Commons. -->
<img src="http://udacity.github.io/fend/lessons/L3/problem-set/02-style-an-image/kitten.jpg" alt="kitten" class="kitten-image">
</body>
</html>
Quiz : Style the Font
<!DOCTYPE html>
<!-- Instructions: Replicate the same styling seen in the Udacity text below. -->
<html>
<head>
<title>Style the Font Quiz</title>
<style>
.udacity-text {
/* add CSS here */
}
</style>
</head>
<body>
<h1 class="udacity-text">udacity</h1>
</body>
</html>
Quiz : Writing Selectors
andtheSELECTIONis
Quiz : Using Attributes
<!DOCTYPE html>
<!-- Instructions: Using the provided HTML and CSS, add the correct attributes to the HTML to replicate the same webpage pictured below. -->
<html>
<head>
<meta charset="utf-8">
<title>Using Attributes Quiz</title>
<style>
body {
font-family: Arial;
}
#to-do-list {
width: 400px;
background: #2e3d49;
padding: 10px 20px;
}
.title {
color: #fff;
}
.underline {
text-decoration: underline;
}
.list {
list-style-type: circle;
text-align: left;
font-size: 16px;
color: #1fba58;
line-height: 24px;
}
.finished {
color: #f4442f;
text-decoration: line-through;
}
</style>
</head>
<body>
<div id="to-do-list">
<h1 class="title">My To-Do List</h1>
<h2 class="underline title">Chores</h2>
<ul class="list">
<li>load the diswasher</li>
<li>vacuum living room</li>
<li>take out garbage</li>
<li class="finished">sweep the garage</li>
</ul>
<h2 class="underline title">Homework</h2>
<ul class="list">
<li class="finished">brainstorm ideas for Science project</li>
<li class="finished">finish Calculus 2 problems</li>
<li>study for Programming midterm :P</li>
<li>finish Project 0 on Udacity FEND</li>
<li class="finished">find sources for Biology research paper</li>
<li>read first two chapters of The Art of War</li>
</ul>
<h2 class="underline title">Party</h2>
<ul class="list">
<li class="finished">send out invitations</li>
<li>reserve party room at restaurant</li>
<li>order the cake!</li>
</ul>
</div>
</body>
</html>
Quiz : Slack Card
imnotslacking
Quiz : Udacity Site Header
fullsteamahead
Quiz : Link to a Stylesheet
aLINKtotheSTYLEZ
# Lesson 7 : How to write Code Faster
Quiz : Keyboard Shortcuts
150
61
Quiz : What’s Your Favorite Theme?
City Lights Syntax Theme
# Lesson 11 : Data Types & Variables
Quiz : First Expression (2-1)
/*
* Programming Quiz: First Expression (2-1)
*
* Write an expression that uses at least three, different, arithmetic operators
* to log the number 42 to the console.
*/
// this expression equals 4, change it to equal 42
console.log(39 + 5 - 2);
console.log(80 / 2 + 2);
console.log(2 * 20 + 2);
Quiz : Converting Temperatures (2-2)
/*
* Programming Quiz: Converting Tempatures (2-2)
*
* Use the Celsius-to-Fahrenheit formula to set the fahrenheit varible:
*
* F = C x 1.8 + 32
*
* Log the fahrenheit variable to the console.
*
*/
var celsius = 12;
var fahrenheit = celsius*(1.8)+32; /* convert celsius to fahrenheit here */
console.log( fahrenheit/* print out result here */);
Quiz : Favorite Food (2-3)
/*
* Programming Quiz: Favorite Food (2-3)
*/
var Food1 = "Dahi";
var Food2 = "Egg";
var Food3 = "Milk";
console.log(Food1,Food2,Food3/* replace this comment with your string */);
Quiz : String Equality for All (2-4)
/*
* Programming Quiz: String Equality for All (2-4)
*/
// fix the right side of the expression
var answer = "ALL Strings are CrEaTeD equal" == "ALL Strings are CrEaTeD equal";
console.log(answer);
Quiz : All Tied Up (2-5)
/*
* Programming Quiz: All Tied Up (2-5)
*/
var joke = "Why couldn't the shoes go out and play? \nThey were all tied up!"; /* write your joke here */
console.log(joke);
Quiz : Yosa Buson (2-6)
/*
* Programming Quiz: Yosa Buson (2-6)
*/
var haiku = "Blowing from the west\n" + "Fallen leaves gather\n" + "In the east." ;
console.log(haiku);
Quiz : Facebook Post (2-7)
String
String
String
Boolean
Number
Quiz : Semicolons! (2-8)
/*
* Programming Quiz: Semicolons! (2-8)
*/
// your code goes here
var thingOne="red";
var thingTwo="blue";
console.log(thingOne+" "+ thingTwo);
Quiz : What's my Name? (2-9)
/*
* Programming Quiz: What's my Name? (2-9)
*/
// your code goes here
var fullName = "Kshitij Sharma";
Quiz : Out to Dinner (2-10)
/*
* Programming Quiz: Out to Dinner (2-10)
*/
// your code goes here
var bill = 10.25 + 3.99 + 7.15;
var tip = 0.15 * bill;
var total = tip + bill;
console.log("$"+total.toFixed(2));
Quiz : Mad Libs (2-11)
/*
* Programming Quiz: MadLibs (2-11)
*
* 1. Declare a madLib variable
* 2. Use the adjective1, adjective2, and adjective3 variables to set the madLib variable to the message:
*
* 'The Intro to JavaScript course is amazing. James and Julia are so fun. I cannot wait to work through the rest of this entertaining content!'
*/
var adjective1 = 'amazing';
var adjective2 = 'fun';
var adjective3 = 'entertaining';
// your code goes here
var madLib = "The Intro to JavaScript course is " + adjective1 + ". James and Julia are so " + adjective2 + ". I cannot wait to work through the rest of this " + adjective3 +" content!";
console.log(madLib);
Quiz : One Awesome Message (2-12)
/*
* Programming Quiz: One Awesome Message (2-12)
*
* 1. Create the variables:
* - firstName
* - interest
* - hobby
* 2. Create a variable named awesomeMessage and, using string concatenation
and the variables above, create an awesome message.
* 3. Print the awesomeMessage variable to the console.
*/
/*
* Notes:
* - Using the above as an example, firstName would have been assigned to
* "Julia", interest to "cats", and hobby to "play video games".
* - Be sure to include spaces and periods where necessary!
*/
// Add your code here
var firstName = "Julia";
var interest = "cats";
var hobby = "play video games";
var awesomeMessage = "Hi, my name is "+ firstName + "." + " I love " + interest + "." + " In my spare time, I like to "+ hobby + ".";
console.log(awesomeMessage);
# Lesson 9 : Data Types & Variables
Quiz : First Expression (2-1)
/*
* Programming Quiz: First Expression (2-1)
*
* Write an expression that uses at least three, different, arithmetic operators
* to log the number 42 to the console.
*/
// this expression equals 4, change it to equal 42
console.log(39 + 5 - 2);
console.log(80 / 2 + 2);
console.log(2 * 20 + 2);
Quiz : Converting Temperatures (2-2)
/*
* Programming Quiz: Converting Tempatures (2-2)
*
* Use the Celsius-to-Fahrenheit formula to set the fahrenheit varible:
*
* F = C x 1.8 + 32
*
* Log the fahrenheit variable to the console.
*
*/
var celsius = 12;
var fahrenheit = celsius*(1.8)+32; /* convert celsius to fahrenheit here */
console.log( fahrenheit/* print out result here */);
Quiz : Favorite Food (2-3)
/*
* Programming Quiz: Favorite Food (2-3)
*/
var Food1 = "Dahi";
var Food2 = "Egg";
var Food3 = "Milk";
console.log(Food1,Food2,Food3/* replace this comment with your string */);
Quiz : String Equality for All (2-4)
/*
* Programming Quiz: String Equality for All (2-4)
*/
// fix the right side of the expression
var answer = "ALL Strings are CrEaTeD equal" == "ALL Strings are CrEaTeD equal";
console.log(answer);
Quiz : All Tied Up (2-5)
/*
* Programming Quiz: All Tied Up (2-5)
*/
var joke = "Why couldn't the shoes go out and play? \nThey were all tied up!"; /* write your joke here */
console.log(joke);
Quiz : Yosa Buson (2-6)
/*
* Programming Quiz: Yosa Buson (2-6)
*/
var haiku = "Blowing from the west\n" + "Fallen leaves gather\n" + "In the east." ;
console.log(haiku);
Quiz : Facebook Post (2-7)
String
String
String
Boolean
Number
Quiz : Semicolons! (2-8)
/*
* Programming Quiz: Semicolons! (2-8)
*/
// your code goes here
var thingOne="red";
var thingTwo="blue";
console.log(thingOne+" "+ thingTwo);
Quiz : What's my Name? (2-9)
/*
* Programming Quiz: What's my Name? (2-9)
*/
// your code goes here
var fullName = "Kshitij Sharma";
Quiz : Out to Dinner (2-10)
/*
* Programming Quiz: Out to Dinner (2-10)
*/
// your code goes here
var bill = 10.25 + 3.99 + 7.15;
var tip = 0.15 * bill;
var total = tip + bill;
console.log("$"+total.toFixed(2));
Quiz : Mad Libs (2-11)
/*
* Programming Quiz: MadLibs (2-11)
*
* 1. Declare a madLib variable
* 2. Use the adjective1, adjective2, and adjective3 variables to set the madLib variable to the message:
*
* 'The Intro to JavaScript course is amazing. James and Julia are so fun. I cannot wait to work through the rest of this entertaining content!'
*/
var adjective1 = 'amazing';
var adjective2 = 'fun';
var adjective3 = 'entertaining';
// your code goes here
var madLib = "The Intro to JavaScript course is " + adjective1 + ". James and Julia are so " + adjective2 + ". I cannot wait to work through the rest of this " + adjective3 +" content!";
console.log(madLib);
Quiz : One Awesome Message (2-12)
/*
* Programming Quiz: One Awesome Message (2-12)
*
* 1. Create the variables:
* - firstName
* - interest
* - hobby
* 2. Create a variable named awesomeMessage and, using string concatenation
and the variables above, create an awesome message.
* 3. Print the awesomeMessage variable to the console.
*/
/*
* Notes:
* - Using the above as an example, firstName would have been assigned to
* "Julia", interest to "cats", and hobby to "play video games".
* - Be sure to include spaces and periods where necessary!
*/
// Add your code here
var firstName = "Julia";
var interest = "cats";
var hobby = "play video games";
var awesomeMessage = "Hi, my name is "+ firstName + "." + " I love " + interest + "." + " In my spare time, I like to "+ hobby + ".";
console.log(awesomeMessage);
# Lesson 12 : Conditionals
Quiz : Flowcharts (3-1)
Take a look at the flowchart above. What data type would best represent (Yes/No) if you have enough money to purchase the item?
Boolean
Here’s a different flowchart for approaching the castle gates. If you decide to storm the castle, what is the immediate resulting outcome?
A dragon appears and attack!
Quiz : Even or Odd (3-2)
/*
* Programming Quiz: Even or Odd (3-2)
*
* Write an if...else statement that prints `even` if the
* number is even and prints `odd` if the number is odd.
*
* Note - make sure to print only the string "even" or the string "odd"
*/
// change the value of `number` to test your if...else statement
var number = 12;
if (number% 2 === 0) {
console.log("even")
}
else
{
console.log("odd")
}
Quiz : Musical Groups (3-3)
/*
* Programming Quiz: Musical Groups (3-3)
*/
// change the value of `musicians` to test your conditional statements
var musicians = 20;
if (musicians === 1) {
console.log("solo");
}// your code goes here
else if (musicians === 2) {
console.log("duet");
}// your code goes here
else if (musicians === 3) {
console.log("trio");
}// your code goes here
else if (musicians === 4) {
console.log("quartet");
}// your code goes here
else if (musicians > 4) {
console.log("this is a large group");
}// your code goes here
else {
console.log("not a group");
}
Quiz : Murder Mystery (3-4)
/*
* Programming Quiz: Murder Mystery (3-4)
*/
// change the value of `room` and `suspect` to test your code
var room = "gallery";
var suspect = "Ms. Van Cleve";
var weapon = "";
var solved = false;
if (room === "dining room" && suspect === "Mr. Parkes") {
weapon = "knife";
solved=true;
} else if (room === "billiards room" && suspect === "Mrs. Sparr") {
weapon = "pool stick";
solved=true;
} else if (room === "gallery" && suspect === "Ms. Van Cleve") {
weapon = "trophy";
solved=true;
} else if (room === "ballroom" && suspect === "Mr. Kalehoff") {
weapon= "poison";
solved=true;
}
if(solved) {
console.log(suspect + " did it in the " + room + " with the " + weapon + "!");
}
Quiz : Checking your Balance (3-5)
/*
* Programming Quiz - Checking Your Balance (3-5)
*/
// change the values of `balance`, `checkBalance`, and `isActive` to test your code
var balance = 325.00;
var checkBalance = true;
var isActive = false;
// your code goes here
if(checkBalance) {
if (isActive && balance > 0) {
console.log("Your balance is $" + balance +".");
}
else if (!isActive) {
console.log("Your account is no longer active.");
}
else if (balance === 0) {
console.log("Your account is empty.");
}
else {
console.log("Your balance is negative. Please contact bank.");
}
}
else {
console.log("Thank you. Have a nice day!");
}
Quiz : Ice Cream (3-6)
/*
* Programming Quiz: Ice Cream (3-6)
*
* Write a single if statement that logs out the message:
*
* "I'd like two scoops of __________ ice cream in a __________ with __________."
*
* ...only if:
* - flavor is "vanilla" or "chocolate"
* - vessel is "cone" or "bowl"
* - toppings is "sprinkles" or "peanuts"
*
* We're only testing the if statement and your boolean operators.
* It's okay if the output string doesn't match exactly.
*/
// change the values of `flavor`, `vessel`, and `toppings` to test your code
var flavor = "strawberry";
var vessel = "cone";
var toppings = "cookies";
// Add your code here
if( (flavor === "vanilla" || flavor === "chocolate") &&
(vessel === "cone" || vessel === "bowl" ) &&
(toppings === "sprinkles" || toppings === "peanuts")
) {
console.log("I'd like two scoops of " + flavor + " ice cream in a " + vessel + " with " + toppings + ".");
}
Quiz : What do I Wear? (3-7)
/*
* Programming Quiz: What do I Wear? (3-7)
*/
// change the values of `shirtWidth`, `shirtLength`, and `shirtSleeve` to test your code
var shirtWidth = 23;
var shirtLength = 30;
var shirtSleeve = 8.71;
// your code goes here
if (shirtWidth >=18 && shirtWidth <20 && shirtLength >=28 && shirtLength <29 && shirtSleeve >= 8.13 && shirtSleeve < 8.38) {
console.log("S");
}
else if (shirtWidth >=20 && shirtWidth <22 && shirtLength >=29 && shirtLength <30 && shirtSleeve >= 8.38 && shirtSleeve < 8.63) {
console.log("M");
}
else if (shirtWidth >=22 && shirtWidth <24 && shirtLength >=30 && shirtLength <31 && shirtSleeve >= 8.63 && shirtSleeve < 8.88) {
console.log("L");
}
else if (shirtWidth >=24 && shirtWidth <26 && shirtLength >=31 && shirtLength <33 && shirtSleeve >= 8.88 && shirtSleeve < 9.63) {
console.log("XL");
}
else if (shirtWidth >=26 && shirtWidth <28 && shirtLength >=33 && shirtLength <34 && shirtSleeve >= 9.63 && shirtSleeve < 10.13) {
console.log("2XL");
}
else if ((shirtWidth === 28) && (shirtLength === 34) && (shirtSleeve === 10.13)) {
console.log("3XL");
}
else {
console.log("N/A");
}
Quiz : Navigating the Food Chain (3-8)
var eatsPlants = false;
var eatsAnimals = true;
var category = (eatsPlants && eatsAnimals) ? "omnivore" : (eatsAnimals) ? "carnivore" : (eatsPlants) ? "herbivore" : undefined ;
console.log(category);
Quiz : Back to School (3-9)
var education = "no high school diploma";
// set the value of this based on a persons education
var salary;
// your code goes here
switch (education) {
case "no high school diploma":
salary="$25,636/year";
console.log("In 2015, a person with " + education + " earned an average of " + salary.toLocaleString("en-US") + ".");
break;
case "a high school diploma":
salary="$35,256/year";
console.log("In 2015, a person with " + education + " earned an average of " + salary.toLocaleString("en-US") + ".");
break;
case "an Associate's degree":
salary="$41,496/year";
console.log("In 2015, a person with " + education + " earned an average of " + salary.toLocaleString("en-US") + ".");
break;
case "a Bachelor's degree":
salary="$59,124/year";
console.log("In 2015, a person with " + education + " earned an average of " + salary.toLocaleString("en-US") + ".");
break;
case "a Master's degree":
salary="$69,732/year";
console.log("In 2015, a person with " + education + " earned an average of " + salary.toLocaleString("en-US") + ".");
break;
case "a Professional degree":
salary="$89,960/year";
console.log("In 2015, a person with " + education + " earned an average of " + salary.toLocaleString("en-US") + ".");
break;
case "a Doctoral degree":
salary="$84,396/year";
console.log("In 2015, a person with " + education + " earned an average of " + salary.toLocaleString("en-US") + ".");
break;
default:
console.log ("nothing");
break;
}
# Lesson 13 : Loops
Quiz : JuliaJames (4-1)
var x = 1;
while (x <=20) {
if (x%3 === 0 && x%5 === 0) {
console.log("JuliaJames");
}
else if (x%5 === 0) {
console.log("James");
}
else if (x%3 === 0){
console.log("Julia");
}
else {
console.log(x);
}
x=x+1;
}
Quiz : 99 Bottles of Juice (4-2)
/*
* Programming Quiz: 99 Bottles of Juice (4-2)
*
* Use the following `while` loop to write out the song "99 bottles of juice".
* Log the your lyrics to the console.
*
* Note
* - Each line of the lyrics needs to be logged to the same line.
* - The pluralization of the word "bottle" changes from "2 bottles" to "1 bottle" to "0 bottles".
*/
var num = 99;
while (num >=0) {
if (num > 2) {
sub=num - 1;
console.log(num +" bottles of juice on the wall! " + num+ " bottles of juice! Take one down, pass it around... "+ sub + " bottles of juice on the wall!");
}
else if (num == 2){
sub=num - 1;
console.log(num +" bottles of juice on the wall! " + num+ " bottles of juice! Take one down, pass it around... "+ sub + " bottle of juice on the wall!");
}
else if (num === 1) {
sub=num - 1;
console.log(num +" bottle of juice on the wall! " + num+ " bottle of juice! Take one down, pass it around... "+ sub + " bottles of juice on the wall!");
}
num = num - 1;
}
Quiz : Countdown, Liftoff! (4-3)
/*
* Programming Quiz: Countdown, Liftoff! (4-3)
*
* Using a while loop, print out the countdown output above.
*/
// your code goes here
var x=60;
while(x>=1){
console.log("T"+x);
x=x-1;
for(var x=9; x>=1; x=x-1)
{
console.log("T-"+x);
}
}
Quiz : Changing the Loop (4-4)
/*
* Programming Quiz: Changing the Loop (4-4)
*/
// rewrite the while loop as a for loop
var x = 9;
for(var x=9; x>=1; x=x-1) {
console.log("hello " + x);
}
Quiz : Fix the Error 1 (4-5)
/*
* Programming Quiz: Fix the Error 1 (4-5)
*/
// fix the for loop
for (var x=5;x < 10; x++) {
console.log(x);
}
Quiz : Fix the Error 2 (4-6)
/*
* Programming Quiz: Fix the Error 2 (4-6)
*/
// fix the for loop
for (var k = 0; k < 200; k++) {
console.log(k);
}