pass variables to eval code example
Example: javascript eval passing variable
// Code you want to evaluate
var code = 'return this.whatever'
// What you want "this" bound to:
var that = { whatever: 69 }
// Now do this:
var result = new Function(code).call(that)