Open twalker12 opened 7 years ago
Can you take a look at this? I have error and I'm not sure what's wrong. I also document.write but I'm not sure if i'm supposed to use that or response.write because I saw both when I googled it. Can you tell me what I need to fix? Thanks
Hey Tamesha,
The server won't run for a few reasons. First, some of your response.end
functions are missing quotes.
When you have something like this:
response.end(<a href="...">...</a>)
it won't render unless you add quotes:
response.end('<a href="...">...</a>')
You also want to make sure that you're using response.end
or response.write
. document.write
won't do anything in this case. If you do use response.write
, you'll also have to call response.end()
afterward, otherwise the page will look like it's trying to load something even after everything has already been displayed.
You also use a variable that hasn't been defined here: rnd
. Not sure if you had a variable by that name before and removed it, but as a general rule, javascript will try to read anything that's not surrounded by quotes as code. Anything that is surrounded by quotes will be read as a string. Unless the code you're using is build into javascript, you'll have to create any variable you want to use.
Ok I made the changes it still doesn't seem to be working.
Ok, what else have you tried? Have you linted your code for errors?
Hi @twalker12, don't spend any more time on this. I'm putting together an alternative assignment for you.
Hi Tamesha, I just sent you an email! Make sure to check it as it contains details for an alternative assignment 🙂
Build a simple web server that handles any URL
@stuartpearman Can you take a look at this? It's hosted here and meets the following criteria:
h1
element (though for this project, it doesn't have to be a complete HTML page)/
, they see a greeting/random-joke
, they see one of at least three knock-knock jokes (Math.random()
may be useful 😉)/cuteness
, they see a picture of a cute animal (I'm sure you can find one on the Internet 😛)/
) contains a link to it