yeon
yeon I am a Korean web programmer with bboy dancing as a hobby. :)

Days 0: Hello world!

Days 0: Hello world!

hacker rank



10 Days of Javascript


Days 0: Hello world!


Input Format


Data Type Parameter Description
string parameter valiable 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 parameter valiable.


Sample Input

1
Welcome to 10 Days of JavaScript!


Sample Output

1
2
Hello, World!
Welcome to 10 Days of JavaScript!



My code


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    
    main();    
});

function readLine() {
    return inputString[currentLine++];
}

/**
*   A line of code that prints "Hello, World!" on a new line is provided in the editor. 
*   Write a second line of code that prints the contents of 'parameterVariable' on a new line.
*
*	Parameter:
*   parameterVariable - A string of text.
**/
function greeting(parameterVariable) {
    // This line prints 'Hello, World!' to the console:
    console.log('Hello, World!');
    console.log(parameterVariable);
}

function main() {
    const parameterVariable = readLine();
    
    greeting(parameterVariable);
}



Hacker Rank > 10 Days of Javascript > Days 0: Hello world!Symmetric-Difference

comments powered by Disqus