Hacker News new | ask | show | jobs
by high_byte 1916 days ago
so this is basically eval('var input = inputElement.innerText;' + jsElement.innerText)
1 comments

Basically, yes. In practice, there's a bit more to it. The user code is wrapped into an "async function(input)" (so you can use async/await) and run inside a worker inside a sandboxed iframe (for security reasons and for being able to stop the execution). There's also some additional code for catching errors and parsing the error stack.