Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Hannah Cherba
Hannah Cherba
889 Points

404 error in chrome console. Not allowing me to run program.

Hello, I completed an assignment in my workspace and it ran just fine, but then when I was completing another assignment, it wouldn't let me run the code. The 404 error message kept coming up in the console. I tried to run my previous program in the workspace, to make sure it wasn't a syntax error, but it got the same message (even though I hadn't made any changes to the code and had updated the html file). I updated my mac and chrome, shut down my computer, tried running the same workspace on another computer, and nothing has worked. I even tried running another program I had made from a previous workspace (that had run perfectly before) and it wouldn't run. The same error message kept popping up in the console: Failed to load resource: the server responded with a status of 404 (Not Found) /favicon.ico:1

Any help would be much appreciated...I've spent the last few hrs trying to figure this out.

Thank you, Hannah

Bella Bradbury
Bella Bradbury
Web Development Techdegree Student 12,629 Points

Hello Hannah! We'll need the complete code to be able to assist you. It can be so frustrating when something's not working correctly, to help you we'll need to try replicating the issue.

Hannah Cherba
Hannah Cherba
889 Points
var num1;
var num2;
var message;

// announce the program
alert("Let's do some math!");

// collect numeric input
num1 = prompt("Please type a number");
num1 = parseFloat(num1);
num2 = prompt("Please type another number");
num2 = parseFloat(num2);
if ( num2 === 0 ) { 
  alert("The second number is 0. You can't divide by zero. Reload and try again.");
} else if ( isNaN(num1) || isNaN(num2) ) {
  alert("At least one of the values you typed is not a number. Reload and try again."); 
} else {
  message = "<h1>Math with the numbers " + num1 + " and " + num2 + "</h1>";
message += num1 + " + " + num2 + " = " + (num1 + num2);
message += "<br>";
message += num1 + " * " + num2 + " = " + (num1 * num2);
message += "<br>";
message += num1 + " / " + num2 + " = " + (num1 / num2);
message += "<br>";
message += num1 + " - " + num2 + " = " + (num1 - num2);

// write message to web page
document.write(message); } 
/* And then the code for the html:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>JavaScript Numbers</title>
    <link href="css/style.css" rel="stylesheet"> 
    <script src="js.random.js"></script>  

Thank you!

1 Answer

Steven Parker
Steven Parker
218,596 Points

On the line: <script src="js.random.js"></script>, if your file is named random.js and is located in a directory named js, then the source attribute should be: src="js/random.js" (note the slash instead of a period).

Otherwise, this appears to work just fine. But there could be some other issue based on file organization. When you need help with a workspace problem, always make a snapshot of your workspace and post the link to it here.

Hannah Cherba
Hannah Cherba
889 Points

Ahh! Thank you so much! It worked, and I tried it on a couple different programs to make sure.