FAQ & Troubleshooting [JavaScript]



Below is a few ways that can help you if you are getting an error in JavaScript course

If you are stuck then feel free to use the “New Topic” button to post your question in a new thread and everyone will try their very best to help you :slight_smile:

How to use this forum
How to format posts

Some common mistakes with JavaScript syntax:

  • When checking two conditions remember to use two equals signs not one. This for example is the correct method - if(userAge == 91){/*code*/}
  • When closing an if statement after the curly bracket do not add a semi colon. like so:
//do not do this
//as you will get unexpected error 
  • This mistake is very common, PLEASE check your code and make sure you have your semi colons when needed. You can see the list here so you know when to add semi colons and when to avoid adding semi colons.
  • Be careful with that you must not create an infinite loop.
    An example of an infinite loop is when a loop is created but a limit is not set
var i = 1;
while (i < 10) {

Notice that the variable i is never incremented in the body of the loop, meaning that the condition of the loop will always remain true. An endless stream of the number 1 will be printed to console.

  • If you get the error - “Your code/function did not return XYZ string for some input” make sure you have all the punctuation in your returned string correct. It is recommended to copy-paste the exact string as shown in the Instructions.

If you have the correct code and syntax and you are getting an error then you may be experiencing a web browser issue or glitch in the course.

Try the following:

  • Refreshing your web page
  • Reset the lesson’s code
  • Try a different web browser
  • confirm() is creating a pop-up window so if you have strict pop-up blocking on that could be interfering.
  • If your web page becomes unresponsive or just keeps on loading chances are that you have an infinite loop
  • Sometimes you need to have the exact same text as mentioned in instructions, so full stops, exclamation marks, uppercase, lowercase needs to be exact same.

JS Glossary

The system keeps telling me theres something wrong with my syntax. and I can't figure out what it is