const sum = new Function('a', 'b', 'return a + b'); console.log(sum(2, 6)); // expected output: 8
JavaScript Demo: Function()
Run ›
Reset