-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathvariables.js
More file actions
51 lines (43 loc) · 2.82 KB
/
variables.js
File metadata and controls
51 lines (43 loc) · 2.82 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
/*******************************************************************************
These tasks will provide you with an opportunity to practice creating and manipulating variables,
as well as using string concatenation and getting familiar with different datatypes.
// Have fun! //😃
********************************************************************************/
/*******************************************************************************
Task 1 (Variables):
Steps:
1. Create three variables named 'personName', 'age', and 'isHappy', where:
- 'personName' should hold a string value
- 'age' should hold a numeric value
- 'isHappy' should hold a boolean value.
2. Use console.log() to output the value of each variable.
********************************************************************************/
// TODO: ADD YOUR CODE BELOW
/*******************************************************************************
Task 2 (Reassigning variables):
Steps:
1. Create a new variable named 'nickName' and assign the value of the 'personName' variable to the 'nickName' variable.
2. Use console.log o output the value of 'nickName'
*******************************************************************************/
// TODO: ADD YOUR CODE BELOW
/*******************************************************************************
Task 3 (Naming variables):
Steps:
1. Create a variable with the title of your favorite movie. How would you name such a variable?
2. Declare a variable that stores the age of a user. What name would you choose for this variable?
*******************************************************************************/
// TODO: ADD YOUR CODE BELOW
/*******************************************************************************
Task 4 (String Concatenation):
Build upon the previous task by completing the following steps:
Steps:
1. Declare a new variable called 'msg'.
2. Use the `prompt()` function to ask the user to enter a message for the person you just created. Then assign the value to the `msg` variable.
3. Declare a new variable called 'finalMsg'.
4. Then complete the message by following these steps:
- If the value of the 'isHappy' variable above is true, add this text: "And by the way, why are you happy?" to the `msg` variable using string concatenation.
- If the value of the 'isHappy' variable is false, concatenate the message: "And btw, Good for you. There's nothing to be happy about." to the `msg` variable.
- Assign the completed message to the `finalMsg` variable
5. Print the final message to the console, including the `personName` in uppercase in this format `Dear personName_VALUE, here's your message: finalMsg_VALUE.`.
*******************************************************************************/
// TODO: ADD YOUR CODE BELOW