0

Is it possible to change the alert() function to log the message instead of showing up a popup?

Some outside team members does like the use the alert function, but we don't want it because they aren't removing them.

So I want to add some code in our angular application that logs the message in the console instead of popping up. So, I want some code which don't require to change all the calls to alert() but a kind of hook to that function which transforms it to console.log()

NVO
  • 2,566
  • 5
  • 27
  • 57
  • @Turnip aaah, that actually very simple and working! If you add that comment as a reply I mark it is an answer! – NVO Oct 12 '18 at 09:09

1 Answers1

2

Try this

window.alert = window.console.log
window.alert('Hello from console.log')
You Nguyen
  • 9,961
  • 4
  • 26
  • 52