JavaScript Code Daily Challenge #4
Lakshya Tyagi
Posted on November 25, 2020
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.
Functions
https://www.hackerrank.com/challenges/js10-function/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++];
}
Create function in comment
/*
* Create the function factorial here
*/
function main() {
const n = +(readLine());
console.log(factorial(n));
}
💖 💪 🙅 🚩
Lakshya Tyagi
Posted on November 25, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.