Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
2. Use console.log() to output the value of each variable.
********************************************************************************/
// TODO: ADD YOUR CODE BELOW
let personName = "ali";

console.log(personName);
let age = "15";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When declaring a variable that is meant to hold a numeric value, such as age in this case, you should assign it a numerical value directly without enclosing it in double quotation marks. Here's the corrected version of the code:
let age = 15;

console.log(age);
let isHappy = "true";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing for the boolean value, you should assign it directly without enclosing it in double quotation marks. Here's the corrected version of the code:
let isHappy = true;


console.log(isHappy);

/*******************************************************************************
Task 2 (Reassigning variables):
Expand All @@ -24,7 +32,8 @@
2. Use console.log o output the value of 'nickName'
*******************************************************************************/
// TODO: ADD YOUR CODE BELOW

let nickName = personName;
console.log(nickName);
/*******************************************************************************
Task 3 (Naming variables):

Expand All @@ -33,6 +42,9 @@
2. Declare a variable that stores the age of a user. What name would you choose for this variable?
*******************************************************************************/
// TODO: ADD YOUR CODE BELOW
let favoriteMovie = "lion";
let userAge = "20";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job for naming the variables, make sure the numeric values are assigned without enclosing them in double quotation marks.



/*******************************************************************************
Task 4 (String Concatenation):
Expand All @@ -48,3 +60,7 @@ Steps:
- 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
let msg = prompt("the letter");
let finalMsg = `${msg} And btw, Why are you happy?`;
console.log(`Dear ${personName.toUpperCase()}, here's your message: ${finalMsg}`)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great!