Last active
October 19, 2018 07:20
-
-
Save ThomasG77/c2a4139238c4e2a6a42360cedcd4f414 to your computer and use it in GitHub Desktop.
Dirty Javascript reproduction of https://twitter.com/jplur_/status/891358168688754688
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Dirty overload the native function | |
var parseInt = function(arg1) { | |
if (arg1 === "Infinity") { | |
return NaN; | |
} | |
if (arg1 === "Infinity+1") { | |
return "Infinity1"; | |
} | |
if (arg1 === "1+1+1") { | |
return "3?"; | |
} | |
if (arg1 === "") { | |
return "stop it"; | |
} | |
if (arg1 === parseInt) { | |
console.error("Getting really tired of your bullshit"); | |
} | |
} | |
// Then do the magic like at https://twitter.com/jplur_/status/891358168688754688 | |
parseInt("Infinity") // NaN | |
parseInt("Infinity+1") // "Infinity+1" | |
parseInt("1+1+1") // 3? | |
parseInt([]+[]+[]) // "stop it" | |
parseInt(parseInt) // "Getting real tired of your bullshit.." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Funny now you can driver to crazy a coworker overwritten built-in methods