在代码中,为什么使用以下行,因为它没有从集合列表创建电子邮件。
歧义代码行:"返回{$item}$@{ this.domain }
"
var object = {
collection: ["kapil", "abdul", "shiv"],
domain: 'infobeans.com',
method: function method() {
return this.collection.map(item => {
//return item + '@' + this.domain;
return `{$item}$@{ this.domain }`
});
}
};
console.log(object.method());
答案 0 :(得分:1)
var object = {
collection: ["kapil", "abdul", "shiv"],
domain: 'infobeans.com',
method: function method() {
return this.collection.map(item => {
//return item + '@' + this.domain;
return `${item}@${ this.domain }`
});
}
};
console.log("object.method",object.method());