About prompt

platform_issue

#1
// described the kelvin variable
const kelvin = prompt('What is the kelvin temperature today?');
//described the celcius variable as 273 minus of kelvin
const celsius = kelvin - 273;
//described the fahrenheit variable
const fahrenheit = celsius*(9/5) + 32;
//described again the fahrenheit
fahrenheit = Math.floor(fahrenheit);

console.log(`The temperature is ${fahrenheit} degrees Fahrenheit.`);

Hi
Where am I making a mistake? I am about to go mad. I did not do it in no way.
How can I use the Prompt.


#2

What error message are you getting? Please post a URL to the lesson page you are on.


#3
/home/ccuser/workspace/learn-javascript-intro-kelvin-weather/app.js:2
const kelvin = prompt('What is the kelvin temperature today?','273');
               ^

ReferenceError: prompt is not defined
    at Object.<anonymous> (/home/ccuser/workspace/learn-javascript-intro-kelvin-weather/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

How do I define it?


#4

Sorry to ask again… Please copy the URL from the address bar and paste in directly, not in code markdown.

Refresh the page. It may be that the prompt() function has been overwritten by,

prompt = ...

#5

https://www.codecademy.com/courses/learn-javascript-introduction/projects/kelvin-weather?course_redirect=introduction-to-javascript


#6

Did you try a page refresh? We need to restore the JavaScript namespace.


#7

Yes, I did it several times.
Is the code I wrote true or false ?
If it is false, can you write it down again?


#8

Update: Have been able to reproduce the error, indicating a glitch in the lesson interface. It is not our code.

A workaround that will get you through this project…

//let kelvin = prompt('What is the Kelvin temperature today?');
let kelvin = 0

#9

When I did this project first time, it is maybe a year ago, the project wanted me to use prompt and it was working. Even I took a video at that time.

But now, even I wrote the same code again, it is still not working.

const kelvin = prompt("What is the Kelvin temperature today?");
const celsius = kelvin - 273;
const fahrenheit = celsius*(9/5) +32;
Math.floor(fahrenheit);
console.log(`The temperature is ${fahrenheit} degrees fahrenheit today.`);

This is the error that displayed I wrote the code above.


#10

It’s definitely a platform issue. Get something to display in the console, check off all the questions so it shows 13/13 and move forward.


#11

By the way, the project does not want me to use prompt() now, but still, the platform should not fail, right?
And I checked off all the questions.


#12

Now you are able to follow the instructions without facing any issues. Use let on your kelvin variable so it can be changed later.


#13

Sorry but I did not understand anything. I want to input for the project. How can I accomplish it.


#14

You cannot use prompt due to whatever issue is present. The course was revised to eliminate it, rather than address the issue, or perhaps it was more than anybody had time to invest in. Cannot say, only speculate.

If you wish to use prompt, then write the code on your computer and run it there.


#15

Where can I write and run the JavaScipt codes?
Is there any compiler for JavaScript you can recommend me?


#16

Your browser. Write code in your favorite text editor, save it with a sensible name. Copy the code and paste it at the prompt in the JavaScript Console, and hit enter. It executes immediately. This takes some getting to know, but no time like the present to familiarize yourself with the tools at your fingertips.

In Chrome, open a blank page (about: blank in the location bar) and Ctrl+Shift+J to open the console.

repl.it has a sandbox for a great many languages, and it is similar to this learning interface with the exception it has a console.

If you have not taken HTML/CSS then you should not skip those courses. They are the API’s that JS is written to interact with. We can talk more about that later.


#17

Thanks a lot Roy :slight_smile:


#18

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