Last active
May 2, 2021 10:19
-
-
Save Jaezmien/48d23a52a339f11881e87629fa71878c to your computer and use it in GitHub Desktop.
π Execute and listen the console.log of a code
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
function exec_js(code) { | |
var _log = console.log; | |
var logs = []; | |
console.log = function(...value) { | |
_log.apply(console, arguments); | |
logs.push( value ); | |
} | |
Function( code )(); | |
console.log = _log; | |
return logs; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment