Computer scienceBackendNode.jsCore ConceptsInternal modulesReadline

Readline module

Even or odd

Report a typo

Write a program to read a number from the user and output if the input is even or odd.

The prompt message should be: Enter a number: . Note that the input will be a string.

Use the 'line' event to listen for input!

Sample Input 1:

5

Sample Output 1:

Enter a number: Odd
Write a program in JavaScript
const readline = require('readline');

// Write your code here

Create a free account to access the full topic