I have a kinda strange task: create a function that creates other functions (and they will wrap text in HTML tags).
The problem is I can't figure out how to pass parent arguments in child function.
function wrapperBuild(tag) {
return new Function('text', "return '<' + tag + '>' + text + '<' + tag + '/>");
};
let wrapP = wrapperBuild("p");
console.log(wrapP('some text'));
//expected output: <p>some text</p>