Question:
JavaScript syntax wont work?
2013-05-16 08:19:44 UTC
So I am making a javascript text rpg for a friend who requested it, anyway the code is written so when the page is load / reloaded the code will run. I tried it without the name enter section and it works, so there must be something wrong with that section.
I have attached the code, so you can see it in context.








Thanks in advance
Four answers:
Thread7
2013-05-16 08:33:00 UTC
Actually you didn't put a semi colon behind this line:

alert("Welcome, " + pName " the" + choice)



That pretty much breaks everything.

This should fix it:

alert("Welcome, " + pName " the" + choice);



To debug stuff like this use chrome as your browser, right click "Inspect Element", then click "Console". Or in FireFox use a plug-in called Firebug.
Nguyen Thanh
2013-05-16 08:44:44 UTC
function hobbit()

{

alert("Welcome, " + pName +" the" + choice)

}



Use Firebug Addon for Firefox to debug problems.



Sorry i speak english not well.
maxey
2016-10-16 10:55:40 UTC
you would be doing the calculation number123.length each and each time in the direction of the loop - which will sluggish this methodology down. different than that it may artwork. Programming one 0 one rule of thumb: get rid of all calculations that don't exchange in the process the loop to exterior the loop.
2013-05-16 08:22:36 UTC
if (pName < 5) ...



pName is a name ... how can a name be less than 5 ... hint ;) get the string length


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...