If you are editing JavaScript locally or through node.js, you can also use the console
object. As shown in previous examples, console.log
prints something to the console when called. If you are familiar with Java, it's just like debugging with the System.out.print()
statement.
You can use this function to write log messages at runtime to identify where the error in the program occurs. Below are some methods of the console object:
debug(message)
info(message)
log(message)
warn(message)
error(message)