Why is console.log() considered better than alert()?

  • alert() is blocking
  • alert() cannot be easily suppressed in non-debug environment
  • console typically formats your objects nicely and allows to traverse them
  • logging statements often have an interactive pointer to code which issued logging statement
  • you cannot look at more than one alert() message at a time
  • consoles can have different logging levels with intuitive formatting

Leave a Comment