Javascript Function Creation Question 3

Introduction

What is the output of the following code?


let func = "return x + y;";
let x = 3;
let y = 4;

let newFun = new Function("x","y",func);
let result = newFun(x,y);
console.log(result);


7



PreviousNext

Related