📜  eval() 函数 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:37.361000             🧑  作者: Mango

代码示例1
console.log(eval('2 + 2'));
// expected output: 4

console.log(eval(new String('2 + 2')));
// expected output: 2 + 2

console.log(eval('2 + 2') === eval('4'));
// expected output: true

console.log(eval('2 + 2') === eval(new String('2 + 2')));
// expected output: false