如何在 console.log 中对多个变量使用单引号

How to use single quotes in console.log with multiple variables

如果我写

console.log("entered values are "+A+" and "+B);

tsLint 抱怨我应该使用 single quotes。我发现如果我使用单引号,那么我不能在单个 console.log 中使用多个变量,即我不能做

console.log('entered values are '+a+' and '+B);

如果 tslint 关于引号的警告打开,我不能使用多个变量和单引号,我说得对吗?

你错了。我你有一个类型,比如把A改成a

"entered values are "+A+" and "+B

等同于

'entered values are '+A+' and '+B`  

等同于

`entered values are ${A} and ${B}`