JavaScript动态应用代码(有点像Java里的drools)

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));

 

上一篇:C# 一行代码随意类型转换


下一篇:动态规划算法-Dynamic Programming,DP