<分区>
我的 app.js 是用 es6 标准写的,我的问题是 > 我怎样才能使用这样的代码?:
$('img').each(() => {
var title = $(this).attr('src');
titles.push(title);
});
我观察到 Node 将此代码编译为:
'use strict';
$('img').each(function () {
var title = $(undefined).attr('src');
titles.push(title);
});
将“this”编译为“undefined”,我该如何解决? 提前致谢 ;)