In this assignment, you will create a simple Node.js application that accepts input from the user and displays a response in the console. This project introduces the basics of Node.js, including working with JavaScript in a server environment and using process for input/output.
-
Create a new file called
main.jsin this folder -
Copy this code into
main.js:-
// Operations: Object Access, Invocation console.log("What's your name?"); // Operations: process.stdin.on('data', function(data) { // Operations: const name = data.toString().trim(); // Operations: console.log(`Hello, ${name}!`); });
-
-
In your terminal, navigate to the project directory.
-
Run your application using Node.js:
node main.js
-
Test your application by typing in a name when prompted and checking if the greeting message is displayed correctly.

