Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #eval #passing #variable
ADD COMMENT
Topic
Name
5+3 =