Contenu du cours
Introduction to JavaScript
Introduction to JavaScript
Task - User Profile & Activity Details
Swipe to start coding
You're developing a user profile and activity tracker for a website. In this task, you'll practice most of the concepts we looked at in the previous chapters.
Your task is to:
- Declare a constant called
DEFAULT_COUNTRY
with the value"United States"
. - Declare a variable
username
and assign it"John Doe"
. - Declare a variable
age
and set it to30
. - Declare a variable called
country
and set it equal toDEFAULT_COUNTRY
. - Declare a variable
isSubscribed
and set it totrue
. - Declare a variable
loginCount
and set it to5
. - Declare a variable
loginReward
and set it to250
.
- In the next line, increment the
loginCount
using the++
operator. - Increase
loginReward
by50
using the+=
operator.
-
Declare a variable
welcomeMessage
that joins the following strings using the+
operator in order:username
" is "
age
" years old and has logged in "
loginCount
" times. The Login Reward balance is "
loginReward
-
Output
welcomeMessage
usingconsole.log()
.
Solution
Merci pour vos commentaires !
Task - User Profile & Activity Details
Swipe to start coding
You're developing a user profile and activity tracker for a website. In this task, you'll practice most of the concepts we looked at in the previous chapters.
Your task is to:
- Declare a constant called
DEFAULT_COUNTRY
with the value"United States"
. - Declare a variable
username
and assign it"John Doe"
. - Declare a variable
age
and set it to30
. - Declare a variable called
country
and set it equal toDEFAULT_COUNTRY
. - Declare a variable
isSubscribed
and set it totrue
. - Declare a variable
loginCount
and set it to5
. - Declare a variable
loginReward
and set it to250
.
- In the next line, increment the
loginCount
using the++
operator. - Increase
loginReward
by50
using the+=
operator.
-
Declare a variable
welcomeMessage
that joins the following strings using the+
operator in order:username
" is "
age
" years old and has logged in "
loginCount
" times. The Login Reward balance is "
loginReward
-
Output
welcomeMessage
usingconsole.log()
.
Solution
Merci pour vos commentaires !