2
我有两个javascript对象用于复制数据对象。它们通过onclick事件填充,我想在保存事件后清除它们。内部JavaScript清除功能
例如,
var currentStrategy = {
id : "",
label : "",
dueDate : "",
comments = [],
save : saveStrategyHandler,
clear : function() {
//how do I clear the fields above in here?
}
}
我已经试过
function(){
id = "";
label = "";
dueDate = "";
comments = [];
}
和
function(){
currentStrategy = {};
}
但既不工作。
分配给您的对象的*属性*,而不是一些变量。 – Bergi