Skip to content

Instantly share code, notes, and snippets.

@cmilfont
Created June 13, 2011 00:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmilfont/1022154 to your computer and use it in GitHub Desktop.
Save cmilfont/1022154 to your computer and use it in GitHub Desktop.
Eval is Evil 3
var sessionScope = {
cart: {
numberOfItems: 10
}
}
var el = "${sessionScope.cart.numberOfItems > 0}".replace("${", "").replace("}", "");
var statement = "return " + el;
var parser = new Function(statement);
console.log(parser());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment