+ 5

How to know where is error of my JavaScript code?

i'm starting coding through JavaScript and sometimes i'm fail to find my JavaScript errors, so there is any way to easily find error?

28th Jun 2017, 1:36 PM
Nasir
Nasir - avatar
4 Réponses
+ 4
Adding Comments is a useful way ! ^_^
28th Jun 2017, 1:37 PM
Ekansh
+ 3
Yup. Console.Log is a good way to have it print stuff to the console for you to read; this is useful because you can set it up in various parts of your code so you get a better idea of where the code fails at. Also, you can use the console in most browsers to see what errors it's returning. It's displayed similar to how a compiler gives you errors. Very useful. This is also where you'll read the logs you created with Console.Log.
28th Jun 2017, 1:41 PM
AgentSmith
+ 2
To add onto what Netkos said, you can print any of the variables / data to the console with Console.Log. This is useful to see what values your variables had prior to it receiving an error.
28th Jun 2017, 1:49 PM
Taco Jack
+ 1
thanks everyone, i've find out another method that is jshint.com to finding error.
29th Jun 2017, 6:06 AM
Nasir
Nasir - avatar