字符串拼接
Posted benbenjia
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了字符串拼接相关的知识,希望对你有一定的参考价值。
控制台中:字符串:红色;变量:白色
js中
js中jss
self.DocPaiBanDictArry.push({ TAST_NAME: item.TAST_NAME, style:"width:calc(100% / "+len+")"});
html中
<tr data-bind="foreach:$root.DocPaiBanDictArry">
<th data-bind="html: TAST_NAME, attr: { style: style }"></th><!--style="width: calc(100% / 7)" -->
</tr>
打印
var a="abc";var c="abcd";a+"abc"+c
"abcabcabcd"
var a="abc";var c="abcd";a+"‘abc‘"+c
"abc‘abc‘abcd"
var a="abc";var c="abcd";a+‘"abc"‘+c
"abc"abc"abcd"
var a="abc";var c="abcd";a+abc+c
VM9876:1 Uncaught ReferenceError: abc is not defined
at <anonymous>:1:28
var len = ‘fff‘;"width:calc(100% / ‘"+len+"‘)"
"width:calc(100% / ‘fff‘)"
var len = 10;"width:calc(100% / ‘"+len+"‘)"
"width:calc(100% / ‘10‘)"
var len = 10;‘width:calc(100% / "+len+")‘
"width:calc(100% / "+len+")"
var len = 10;‘width:calc(100% / "+len+")‘
"width:calc(100% / "+len+")"
var str = ‘fdsafdsa‘; var str2 = ‘fdsafdsa‘; var len = 10; str + len + str2
"fdsafdsa10fdsafdsa"
var str = ‘fdsafdsa‘; var str2 = ‘fdsafdsa‘; var len = 10; str + len + str2
"fdsafdsa10fdsafdsa"
‘fdsafdsafd"fdsafdsafdsafdas":safdsfsa‘
"fdsafdsafd"fdsafdsafdsafdas":safdsfsa"
var str = "fdsafdsafd";var str2 = fdsafdsafdsafdas; var str3 = ":safdsfsa";str+str2+str3
VM710:1 Uncaught ReferenceError: fdsafdsafdsafdas is not defined
at <anonymous>:1:35
(anonymous) @ VM710:1
var a ="fdfa";
undefined
var len = 10; "width:calc(100% / ‘"+len+"‘)"
"width:calc(100% / ‘10‘)"
"width:calc(100% / ‘"+10+"‘)"
"width:calc(100% / ‘10‘)"
"width:calc(100% / ‘len‘"
"width:calc(100% / ‘len‘"
"width:calc(100% / " + len
"width:calc(100% / 10"
以上是关于字符串拼接的主要内容,如果未能解决你的问题,请参考以下文章