NodeJS Slip 4B solution

Create a file named teacherProfileSystem.js:

// teacherProfileSystem.js
const readline = require('readline');

const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});

// Function to create and display a teacher profile
function createTeacherProfile() {
rl.question('Enter teacher name: ', (name) => {
rl.question('Enter subject: ', (subject) => {
rl.question('Enter years of experience: ', (experience) => {

// Display teacher profile
console.log('\nTeacher Profile:');
console.log('Name: ${name}');
console.log('Subject: ${subject}');
console.log('Experience: ${experience} years');

rl.close();
});
});
});
}
// Start the teacher profile creation process
createTeacherProfile();

No comments:

Post a Comment