ReferenceError: prompt is not defined

So I am confused at the Freeform Project Dog Years. The prompt line, which creates the error in Dog Years, does work when copied in Kelvin Weather. If I copy the prompt line I wrote from Kelvin Weather, which works in that project, to Dog Years, it also creates this error message.

Am I doing something wrong, or is this a bug? I’d really like to know because I cannot find what I’m doing wrong.

const myName = prompt(‘What is your name?’);

ReferenceError: prompt is not defined
at Object. (/home/ccuser/workspace/learn-javascript-intro-dog-years-2/app.js:2:16)
at Module._compile (module.js:571:32)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)
at bootstrap_node.js:542:3

// prompt the user for his name
const myName = prompt('What is your name?');

// assigns my age as value to myAge
const myAge = 22;

// sets the value of earlyYears to 2
let earlyYears = 2;

// Multiple earlyyears by 10.5 to equal early years of a dog
earlyYears *= 10.5;

// the early years have been used in the formula, so subtract those years from my age
let laterYears = myAge - 2;

laterYears *= 4;

myAgeInDogYears = earlyYears + laterYears;

console.log(`My name is ${myName}.`);
console.log(' I am ' + myAgeInDogYears + ' in dog years.');

If the prompt function has somehow been disabled, it might be necessary to supply a name…

const myName = "Your Name";

See if you can at least complete the lesson with that swap.

1 Like

I am having the same issues and needless to say it is has been EXTREMEMELY frustrating. I went on to a later exercise (Rock Paper Scissors) and am having the same issue. “Prompt” doesn’t seem to be working at all… I wish this would get it sorted out or replace the exercises with ones that don’t ask for it. Huge waste of time…

Just like you, when I copied the code over into the Kelvin exercise, everything worked fine.

So far I’m having the same problem on every project except for the Kelvin one as well. It is BEYOND frustrating, considering I only upgraded to PRO to get the projects. The quizzes are terrible.I think I will ask for a refund on PRO.

I just upgraded today solely for the pro projects and got to the second one, this one, and have been spending more time searching forums to see if it was something I was doing wrong than actually learning. So it is like this for every project but the Kelvin one?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.