是否有一个JavaScript等价于;字符串"&引用;“字符串”;在PHP中?
我目前正在学习一点JavaScript,并提出了一个问题 在PHP中,我习惯于用一个简单的点将文本和字符串绑定在一起,如下所示:是否有一个JavaScript等价于;字符串"&引用;“字符串”;在PHP中?,javascript,php,concatenation,string-concatenation,Javascript,Php,Concatenation,String Concatenation,我目前正在学习一点JavaScript,并提出了一个问题 在PHP中,我习惯于用一个简单的点将文本和字符串绑定在一起,如下所示: echo "Text" . $String . "anotherText" . $anotherString 这在JavaScript中可能吗?(不是回音,而是字符串和文本的绑定。)是的,添加: 'Text' + str + 'anotherText' + anotherString; 在JavaScript中,它是+而不是 示例1: document.writ
echo "Text" . $String . "anotherText" . $anotherString
这在JavaScript中可能吗?(不是回音,而是字符串和文本的绑定。)是的,添加:
'Text' + str + 'anotherText' + anotherString;
在JavaScript中,它是
+
而不是
示例1:
document.write("Text" + somestring + "anotherText" + anotherString);
alert("Text" + somestring + "anotherText" + anotherString);
var john = "Text" + somestring + "anotherText" + anotherString;
示例2:
document.write("Text" + somestring + "anotherText" + anotherString);
alert("Text" + somestring + "anotherText" + anotherString);
var john = "Text" + somestring + "anotherText" + anotherString;
示例3:
document.write("Text" + somestring + "anotherText" + anotherString);
alert("Text" + somestring + "anotherText" + anotherString);
var john = "Text" + somestring + "anotherText" + anotherString;
我认为
document.write
是不必要的document.write
或多或少相当于PHP中的echo
的JavaScript。只需搜索一下提示:>dot operator PHP
应该会导致术语串联->JavaScript串联
就会找到答案。