Building Messages

Easy+15 XP

Mission Briefing

The Grand Bazaar's merchants are struggling to write price tags manually. They need a system to dynamically stamp item names and prices onto their signage.

The Concept: String Manipulation

Instead of hardcoding values, we use variables and parameters to make code dynamic. You can combine strings and variables using Concatenation (+) or modern Template Literals (Backticks ), which let you inject variables directly using ${variable}.

The Objective

Your function receives two parameters: item (a string) and price (a number).

  1. Construct a dynamic message.
  2. The message must read exactly: "The [item] costs [price] rupees."
  3. Return the newly built message. Pay exact attention to spacing!

01EXAMPLE 1

Inputitem = "Phone", price = 50000
Output"The Phone costs 50000 rupees."

02EXAMPLE 2

Inputitem = "Keyboard", price = 2500
Output"The Keyboard costs 2500 rupees."

Constraints

  • Use the parameters inside the string.
  • Pay strict attention to the spaces in the prompt.
FundamentalsStrings
JavaScript
Loading...
3 Hidden

Input Arguments

item"Phone"
price50000

Expected Output

The Phone costs 50000 rupees.

Click RUN to test your solution