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