-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathactivity-conditionals.html
85 lines (69 loc) · 3.54 KB
/
activity-conditionals.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
<!DOCTYPE html>
<html>
<head>
<title>AC Workshop - Activity: Conditionals</title>
<link rel="stylesheet" type="text/css" href="styles.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.3.0/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.3.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</head>
<body>
<div class="container">
<div class="container-inner">
<div class="left-sidebar">
<div class="home-anchor">
<h3><a href="index.html">Intro to Programming with JavaScript</a></h3>
</div>
<div class="navigation-links">
<div class="navigation-link-item"><a href="activity-logging.html">Activity: Logging</a></div>
<div class="navigation-link-item"><a href="lecture-variables.html">Lecture: Variables</a></div>
<div class="navigation-link-item"><a href="activity-variables.html">Activity: Variables</a></div>
<div class="navigation-link-item"><a href="lecture-arrays.html">Lecture: Arrays</a></div>
<div class="navigation-link-item"><a href="activity-arrays.html">Activity: Arrays</a></div>
<div class="navigation-link-item"><a href="lecture-conditionals.html">Lecture: Conditionals</a></div>
<div class="navigation-link-item"><strong><em><a href="activity-conditionals.html">Activity: Conditionals</a></em></strong></div>
<div class="navigation-link-item"><a href="assignment-webproposal.html">Assignment: Web App Proposal</a></div>
<div class="navigation-link-item"><a href="lecture-loops.html">Lecture: Loops</a></div>
<div class="navigation-link-item"><a href="activity-arraysadvanced.html">Activity: Arrays (Advanced)</a></div>
<div class="navigation-link-item"><a href="lecture-functions.html">Lecture: Functions</a></div>
<div class="navigation-link-item"><a href="activity-functions.html">Activity: Functions</a></div>
<div class="navigation-link-item"><a href="activity-fizzbuzz.html">Activity: Fizz Buzz</a></div>
<div class="navigation-link-item"><a href="teamchallenge.html">Team Challenge</a></div>
</div>
</div>
<div class="content">
<h1>Activity: Conditionals</h1>
<p>
Let's do the following exercises with a partner. Grab a couple new neighbors and together go through each of these exercises one at a time. At the end we will ask different groups to present their solutions to each of the challenges and to explain why that is the right answer.
</p>
<p>
For each of these exercises, make a variable at the top containing the given data and below we'll write some <code>if</code> statements!
</p>
<h2>Log Greetings</h2>
<p>
Write a program that logs a different greeting for various different userNames. Try changing the userName at the top and see the different greetings be logged.
</p>
<h2>Primary Colors</h2>
<p>
Given a string that is the name of a color, log if the color is a primary color or not.
</p>
<h2>Even or Odd</h2>
<p>
Given an integer, log if the integer is even or odd. <i>Hint: Google JavaScript's <u>modulo</u> operator</i>
</p>
<h2>Using Arrays</h2>
<p>
Given an array, log if the array is empty or not. <i>Hint: What property do arrays have that is useful to answer this question?</i>
</p>
<h2>What's wrong with this code?</h2>
<pre><code>if myVariable = 10 {
console.log("myVariable was equal to 10")
else {
console.log("myVariable was NOT equal to 10")
}
</code></pre>
</div>
</div>
</div>
</body>
</html>