Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Creating User Profile & Activity Details | Manipulating Data
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Introduction to JavaScript

bookChallenge: Creating User Profile & Activity Details

Task

Swipe to start coding

You're developing a user profile and activity tracker for a website. Complete the program by following the steps below:

  1. Declare a constant called DEFAULT_COUNTRY with the value "United States".
  2. Declare a variable username and assign it "John Doe".
  3. Declare a variable age and set it to 30.
  4. Declare a variable country and set it equal to DEFAULT_COUNTRY.
  5. Declare a variable isSubscribed and set it to true.
  6. Declare a variable loginCount and set it to 5.
  7. Declare a variable loginReward and set it to 250.
  8. Then perform the following updates:
    • Increment the value of loginCount using the ++ operator.
    • Increase loginReward by 50 using the += operator.
  9. Finally: create a variable welcomeMessage that joins the following values using the + operator:
    • username
    • " is "
    • age
    • " years old and has logged in "
    • loginCount
    • " times. The Login Reward balance is "
    • loginReward
  10. Output the welcomeMessage.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 2. ChapterΒ 15
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

close

bookChallenge: Creating User Profile & Activity Details

Swipe to show menu

Task

Swipe to start coding

You're developing a user profile and activity tracker for a website. Complete the program by following the steps below:

  1. Declare a constant called DEFAULT_COUNTRY with the value "United States".
  2. Declare a variable username and assign it "John Doe".
  3. Declare a variable age and set it to 30.
  4. Declare a variable country and set it equal to DEFAULT_COUNTRY.
  5. Declare a variable isSubscribed and set it to true.
  6. Declare a variable loginCount and set it to 5.
  7. Declare a variable loginReward and set it to 250.
  8. Then perform the following updates:
    • Increment the value of loginCount using the ++ operator.
    • Increase loginReward by 50 using the += operator.
  9. Finally: create a variable welcomeMessage that joins the following values using the + operator:
    • username
    • " is "
    • age
    • " years old and has logged in "
    • loginCount
    • " times. The Login Reward balance is "
    • loginReward
  10. Output the welcomeMessage.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 2. ChapterΒ 15
single

single

some-alt