Skip to content

Instantly share code, notes, and snippets.

@DamianMullins
Last active September 20, 2016 20:11
Show Gist options
  • Save DamianMullins/77bf8d69216ee2913ecd9fbf8be15f91 to your computer and use it in GitHub Desktop.
Save DamianMullins/77bf8d69216ee2913ecd9fbf8be15f91 to your computer and use it in GitHub Desktop.
esnextbin sketch
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Cheating Lexical - Eval</title>
</head>
<body>
<p class="a">a: <span></span></p>
<p class="b">b: <span></span></p>
</body>
</html>
function foo (str, a) {
eval(str);
document.querySelector('.a span').innerHTML = a;
document.querySelector('.b span').innerHTML = b;
}
var b = 2;
foo('var b = 3;', 1);
{
"name": "esnextbin-sketch",
"version": "0.0.0"
}
'use strict';
function foo(str, a) {
eval(str);
document.querySelector('.a span').innerHTML = a;
document.querySelector('.b span').innerHTML = b;
}
var b = 2;
foo('var b = 3;', 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment