Anyone else totally lost on JavaScript project here

I’ve been reviewing this same materials and quizes for weeks now and I’m clueless what to do here. I tried typing in things I know and it’s just a bunch of errors. I finally gave up and watched the video but it doesn’t explain anything…

How do I know what to type? Like…how do i tell JavaScript to do this stuff in the instructions?

Once you have typed a command into the workspace in the middle of the page you can either click the save button at the bottom or press the ctrl + enter keys on your keyboard. That should run any code you have typed in there. As far as errors go, it would help if you copied and pasted your code and the error you are getting into your post here.

1 Like

I’m familiar with the code editor…i’ll paste an error below.

// Convert to Newton
let newton = celsius * (33 / 100);

// Round down
newton = Math.floor(newton);

console.log(`The temperature is ${newton} degrees Newton.`);

let newton = celsius * (33 / 100);

ReferenceError: celsius is not defined
at Object. (/home/ccuser/workspace/learn-javascript-intro-kelvin-weather/app.js:2:14)
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

I don’t know how to type what i know. Like…even when i look at the hints and video and type this code it still doens’t work. I know what the stuff in the code does but I don’t know why it was written like that and I don’t have ANY idea what these errors mean.

Is that all of your code so far for this exercise? The code from steps 1 through 11 should also be there.

that is all the code. I deleted the earlier code because the editor always errors when i don’t delete previous code. I didn’t know the first 2 steps needed to be included. I guess I should have learned that somewhere… I think that is the bigger problem…I’ve been reviewing this stuff endlessly and I still have no idea where to begin

The code from the previous steps 1 - 11 defined variables like celsius for instance. When you write let newton = celsius * (33 / 100); the computer doesn’t know what celsius is unless it is defined prior to that line being executed.

You’ll need to repeat the previous steps, and keep the code in the editor. The project is built step by step, and the code progresses to include what you need for the final step(s).

ok. thank you. I guess I’ll review the concepts again…I don’t know why I don’t know what to do

You mentioned deleting previous code due to errors that occur when you don’t. Error messages can be intimidating, but learning to read them, and make sense of them is extremely helpful. If you encounter errors as you go back through this project, feel free to post your code along with the error, and we’ll help you along to turn them into ‘helpful’ messages rather than intimidating red text.

1 Like

Thank you, I’ll try to share them here. Besides the celsius problem…what is all that other stuff in the message? Modules? Bootstrap? Node?

Beyond the reference error, the rest of it is pretty much only useful to Codecademy if the problem were with something other than the code you wrote. Those lines are referencing lines of code that ran your code. Code that is part of the Codecademy Learning Environment. If you were running this code on your own computer, you wouldn’t see all of those extra lines referring to Codecademy’s environment. For example, if I try to execute the line that threw your error on my own computer all I see is this:

> let newton = celsius * (33/100);
ReferenceError: celsius is not defined

As programs get bigger, and have more complex structures, error messages get longer, and contain more information regarding what was going on when the error was thrown.

The error message you received contained couple of additional useful lines that I didn’t include in my previous response. I probably should have included this:

The first line contains the line number of your program where the error was thrown.
The last line also contains the line number as well as the character number that was reached before the error was thrown. In this case, line 2 is:

let newton = celsius * (33 / 100);

The 14th character is the ‘c’ in celsius. That makes sense because the computer had no definition for celsius.

1 Like

I see…The first time I saw all those messages I spent hours googling that stuff and trying to figure out how to learn it or what i needed to do. I’ve tried running code (from other tutorials) on my computer before but those error messages are miles long. I eventually stopped reading the messages because I didn’t understand. What language do I need to learn to understand these…or at least what is important?

No additional language to learn. Those other references are to lines of code in files that the learning environment executes in order to eventually run your code which is in the final file referenced, app.js.

The bottom line of the error message is actually where it starts. If I asked you to open an actual hard copy of a dictionary and look up a word, and that word’s definition included a word, that you didn’t know, so you look up that word, and that second word has a word you need to look up, so you look that up, and this continues until you get to a word for which there is no definition, you’d be stuck. That’s kinda similar to what happened here. You clicked Run, a program started to execute, which executed code in another module which executed code in another module, etc., etc. until finally your code was executed. The numbers at the end of each of line in the error message are where execution stopped for each of those modules when your error was thrown. The only one that you have any control over is the last one app.js, so we don’t need to follow the chain back any farther than that.

1 Like

Thank you. I’ll continue to post errors here…hopefully if I’m able to learn JavaScript they will make more sense.

1 Like