Skip to content

Instantly share code, notes, and snippets.

@tofumatt
Last active October 5, 2015 23:39
Show Gist options
  • Save tofumatt/4e3db82db2db6290b85b to your computer and use it in GitHub Desktop.
Save tofumatt/4e3db82db2db6290b85b to your computer and use it in GitHub Desktop.
var m = "m";
var o = "o";
var z = "z";
var idb = "IndexedDB";
var tricksterVariable = m + o + z + idb;
var myDatabase = window[tricksterVariable];
@tofumatt
Copy link
Author

tofumatt commented Oct 5, 2015

I can even get:

var foo = "m";
foo += "o";
var test = "zIndexedDB";
foo = foo + test;
var myDatabase = window[foo];

without it being too bad, but it's nuts to think how many other edge cases there would be. Frustratingly none of the existing validators/linters check this closely (eslint/jshint for instance don't check this hard for eval with their no-eval rules), but I would like for our validator not to get duped...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment