javascript verify input value hackerrank

Solutions on MaxInterview for javascript verify input value hackerrank by the best coders in the world

showing results for - "javascript verify input value hackerrank"
Lea
23 Jun 2018
1function makeInputVerifier(minimum, maximum) {
2  // write your code here
3  var mini=minimum;
4  var maxi=maximum;
5}
6function verify(val){
7    if(val<mini)return "Input is less than minimum value";
8    if(val>=mini && val<=maxi)return "Input is in range";
9    return "Input is more than maximum value";
10}
11
12
13function main() {
14  const ws = fs.createWriteStream(process.env.OUTPUT_PATH);
15
16  const min = parseInt(readLine().trim());
17  const max = parseInt(readLine().trim());
18  const verify = makeInputVerifier(min, max);
19
20  const input = parseInt(readLine().trim());
21  const result = verify(input);
22
23  ws.write(`${result}\n`);
24  ws.end();
25}
26