0

是否可以将已分配模板文字值的变量传递给函数,然后该函数用函数调用它?

例子:

function strLiteralProcessor(str){
     console.log(str);
     return //what goes here? I want to call the tag function myTagFunc with str, but myTagFuncstr is obviously wrong.
};

var name = prompt("What's your name?");
strLiteralProcessor(`Hi, ${name}!`);

我做了类似的事情myTagFunc(str)还是我错过了什么?

4

0 回答 0