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