我像这样在php中使用了联系人
$location_space = '';
$location_formation = '';
foreach($location as $formation) {
$location_formation .= $formation.', ';
$location_space .= $formation.'<br />';
}
当我想将其更改为 javascript 时:
var location_space = '';
var location_formation = '';
for (i = 0; i < new_location.length; i++) {
var location_space += new_location[i] + ', ';
var location_formation += new_location[i] + '<br />';
}
它向我显示了这个错误
错误:语法错误:缺失;before 语句
Line: 311, Column: 32
Source Code: var location_space += new_location[i] + ', ';
那么有什么问题呢?