When i want to take user input in my code by taking command prompt vs code or node js editor says it is not defined. But as far i know we can take user input in JS by “prompt” .
example :-
function leapYear(year) {
if ((year %2 == 0) && (year %100 != 0) || (year %400 == 0)) {
console.log(year + " LeapYear");
}
else{
console.log(year +" Not a LeapYear");
}
}
const year = Prompt('Enter a year:');
leapYear(year);
Uncaught ReferenceError: prompt is not defined