let $dynamic_code_context; let dynamic_code = "$dynamic_code_context = {server: '192.168.1.123', port: '8000', methods:" + "[function(_this) {return _this.server + ':' + _this.port;}]}"; $dynamic_code_context = eval(dynamic_code); $dynamic_code_context.port = 9334; alert($dynamic_code_context.methods[0]($dynamic_code_context));