“Alert is bad” – really? [closed]

Is there a solid, logical reason to never use alert()?

alert is bad simply because it has no positive features and only negative features

  • blocks the entire browser
  • blocks the javascript thread
  • only prints strings
  • requires user interaction to continue (this means you can’t automate browser usage)
  • is blocked by common popup blockers
  • doesn’t work in non-browser environments like node.js (however console.log does work in node.js)

Does the increased value of console.log() truly reduce the value of alert() so drastically that it goes from “useful in limited scenarios” to “bad”?

Yes, although there are some exceptions

The only value alert has is as a quick hackish tool to debug legacy browser or as a tool to annoy users.

Leave a Comment