- Paste the above code into the Chrome inspector.
- At the Chrome inspector console prompt, type:
console.log('hi');- The result will be an alert message and console.log message.
| (function(){ | |
| var oldLog = console.log; | |
| console.log = function (message) { | |
| // DO MESSAGE HERE. | |
| alert('hi!'); | |
| oldLog.apply(console, arguments); | |
| }; | |
| })(); |