问题描述
如果我写
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}`