For my new Project (JavaScript on Node.js) I have to use a Templateproject.
There I found the following Code Snipped. I want to understand what they doing here. For me it makes no sense.
....
1 lines[lines.length - 1] = lines[lines.length - 1].trim().replace(/};$/, '}');
2 words = lines.join('\n');
3 var resultFunc = new Function('return ' + words + ';');
4
5 return resultFunc();
6 } catch (e) {
....
Why is in Line 4 that "new Function"
and what happen here?
Thanks