Day 0: Hello, World! (HackerRank – 10 Days of Javascript)


greeting function is provided for you in the editor below. It has one parameter, parameterVariable. Perform the following tasks to complete this challenge:

  1. Use console.log() to print Hello, World! on a new line in the console, which is also known as stdout or standard output. The code for this portion of the task is already provided in the editor.
  2. Use console.log() to print the contents of parameterVariable (i.e., the argument passed to main).

Input Format:

Data TypeParameterDescription
string parameterVariable A single line of text containing one or more space-separated words.

Output Format:

Print the following two lines of output:

  1. On the first line, print Hello, World! (this is provided for you in the editor).
  2. On the second line, print the contents of parameterVariable.


function greeting(parameterVariable) {
    // This line prints 'Hello, World!' to the console:
    console.log('Hello, World!');
    // Write a line of code that prints parameterVariable to stdout using console.log:

Leave a Reply