Submissions will no longer be placed on the leaderboard. You may still attempt this problem for practice.

JavaScript ES6 Template Strings

Here's a useful video related to the major features in ES6 including template strings:

Template strings introduce a way to define strings with domain-specific languages (DSLs). It provides improved string interpolation, embedded expressions, multiline strings, formatting, and tagging for safe HTML.

Template Strings

Template strings are string literals allowing embedded expressions.
We can use multi-line strings and string interpolation features with them.

Multiline Strings

Any new line characters inserted in the source are part of the template string.
SAMPLE CODE

console.log(`The HackerRank team is on a mission to flatten the world by restructuring 
the DNA of every company on the planet. We rank programmers based on 
their coding skills, helping companies source great programmers and reduce 
the time to hire.`);

OUTPUT

The HackerRank team is on a mission to flatten the world by restructuring 
the DNA of every company on the planet. We rank programmers based on 
their coding skills, helping companies source great programmers and reduce 
the time to hire.

String Interpolation

We can embed expressions within template strings by making use of its syntactic sugar.
SAMPLE CODE

var contestant = "DOSHI";
var score = "20";

console.log(`Congratulations ${contestant}!, Your score is ${score}.`);

OUTPUT

Congratulations DOSHI!, Your score is 20.

Task

Your task is to create a template string and assign it to the variable my_template_string.

The template string should contain the following data only:

My name is ${my_name}.
My id is ${my_id}.
My address is ${my_address}.

Note

  • Do not create any variable other than my_template_string.
  • Do not print anything on the console.
  • Replace the blank (_______________________) with the template string.
Line: 1 Col: 1
  1. Challenge Walkthrough
    Let's walk through this sample challenge and explore the features of the code editor.1 of 6
  2. Review the problem statement
    Each challenge has a problem statement that includes sample inputs and outputs. Some challenges include additional information to help you out.2 of 6
  3. Choose a language
    Select the language you wish to use to solve this challenge.3 of 6
  4. Enter your code
    Code your solution in our custom editor or code in your own environment and upload your solution as a file.4 of 6
  5. Test your code
    You can compile your code and test it for errors and accuracy before submitting.5 of 6
  6. Submit to see results
    When you're ready, submit your solution! Remember, you can go back and refine your code anytime.6 of 6
  1. Check your score