How to use Function constructor ? [Solved]
In the following code , the first compile one works as expected but second doesn't , why so? ---------------------------- var compile=new Function("data",'return ""+data.abc') console.log(compile(abc)); compile=new Function("data",'return re()'); console.log(compile(abc)) ---------------------- re function returns same string as we have in first compile , i. e. ""+data.abc . So my question is ,does re function returns ""+data.abc or """+data.abc", if it's the former one than it should work well but if it's the latter than it doesn't and so what should i do ? Ty! Here is the code, https://code.sololearn.com/W9UNfxEKENqa/?ref=app Edit: ok , it works fine for just {{abc}}, after adding the string returned by re to return but then again it fails for something like {{abc}} world.