2021年3月29日星期一

Prank Your Coder Friend On April Fools With This

Get Ready To Prank Your Coder Friends With A Simple Code!

Just rewrite the console.log function with:
var $old_consoleLog = console.log;  console.log = function(String){     $old_consoleLog("Bonkers: " + String);  }  

Explanation:

var $old_consoleLog = console.log;   

Stores console.log function as another variable: "$old_consoleLog"

Don't let your coder friend find out this variable
console.log = function(String){     $old_consoleLog("Bonkers: " + String);  }  

Rewrites original console.log function to output "Bonkers: ..."; Can also replace "Bonkers with any other Value as Prefix"

Can Revert Changes with:

console.log = $old_consoleLog;  

Reaction: What? Why Console.log Is Adding Bonkers to its output?

Op?

https://stackoverflow.com/questions/66864267/prank-your-coder-friend-on-april-fools-with-this March 30, 2021 at 11:06AM

没有评论:

发表评论