I've always been told that when debugging an application, JavaScript's console.log()
method is preferred over simply using an alert()
method. Why is this? Is there a good example someone can point me to where console.log()
is obviously the better choice?
alert()
is blockingalert()
cannot be easily suppressed in non-debug environmentconsole
typically formats your objects nicely and allows to traverse themalert()
message at a timeconsole
s can have different logging levels with intuitive formatting