-
Notifications
You must be signed in to change notification settings - Fork 249
/
Copy pathmagicalCreature.js
40 lines (19 loc) · 1.43 KB
/
magicalCreature.js
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
// Welcome to the magical zoo! Your task is to create and manage a list of magical creatures. Let's have some fun!
// 1. Declare a variable named 'creatureName' and assign it a magical creature's name as a string.
// 2. Declare a variable named 'creatureDescription' and describe its magical properties as a string.
// 3. Do you believe that this creature is friendly to humans?
// Declare a variable named 'isFriendly' and assign it a boolean value.
// 4. The magical zoo has an age restriction! Declare a variable named 'visitorAge' and assign it a random age between 1 and 60.
// Hint: Use Math.floor() to round a number down.
// Hint: Use Math.random() for generating random numbers.
// 5. Determine if the visitor is allowed to see the creature.
// Declare a variable named 'canVisit' and assign it an expression to see
// if the visitorAge variable is greater than 15.
// Hint: use this resource if you need support: https://www.w3schools.com/js/js_booleans.asp
// 6. Combine all the information into a summary.
// Declare a variable named 'zooSummary' and combine all the above information using concatenation.
// 7. Print the summary using console.log()
// Challenge:
// 8. Now, imagine there are three more creatures in the zoo.
// Repeat Tasks 1-6 for each creature, then combine all summaries into a single variable 'allZooSummaries'.
// 9. Print the 'allZooSummaries' to see the details of all the creatures in the magical zoo.