+ 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?
4 Answers
+ 4
Adding Comments is a useful way ! ^_^
+ 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.
+ 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.
+ 1
thanks everyone,
i've find out another method that is jshint.com to finding error.