JavaScript Code Daily Challenge #1

lakshyatyagi24

Lakshya Tyagi

Posted on November 21, 2020

JavaScript Code Daily Challenge #1

About

This is a series of JavaScript Code Daily Challenge. Each day I show a few solutions written in JavaScript. The questions are from coding practice/contest sites such as HackerRank, LeetCode, Codeforces, Atcoder and etc.

Day 1: Hello, World
https://www.hackerrank.com/challenges/js10-hello-world/problem

'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++];
}
Enter fullscreen mode Exit fullscreen mode

Function need to be change

function greeting(parameterVariable) {
    console.log('Hello, World!');
    console.log(parameterVariable)
}
Enter fullscreen mode Exit fullscreen mode
function main() {
    const parameterVariable = readLine();

    greeting(parameterVariable);
}
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
lakshyatyagi24
Lakshya Tyagi

Posted on November 21, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

JavaScript Code Daily Challenge #1
javascript JavaScript Code Daily Challenge #1

November 21, 2020

JavaScript Challenge 2: Word Scrambles
javascript JavaScript Challenge 2: Word Scrambles

October 4, 2020

JavaScript Challenge 1: Simple Pig Latin
javascript JavaScript Challenge 1: Simple Pig Latin

September 29, 2020