如何将fNameTD + lNameTD组合在一起?
let fNameTD = $('<td>').text(employees[i].FirstName);
let lNameTD = $('<td>').text(employees[i].LastName);
答案 0 :(得分:0)
您可以将字符串与+
连接起来,类似于我在下面的操作:
let employees = [{
firstName: 'Bill',
lastName: 'Jones'
}, {
firstName: 'Tom',
lastName: 'Davis'
}];
for (let i = 0; i < employees.length; i++) {
let fullNameTd = employees[i].firstName + ' ' + employees[i].lastName;
console.log(fullNameTd);
}
&#13;