I'm writing a javascript file where the variable with revealing pattern is destroyed in the end.
var variable = function () {
var data = 3;
function getme () {
return data;
}
return {
fdata: data,
me: getme
};
}();
As there is no in-built delete option for variables, is it ok to replace it with property like this.
this.variable = function () {
var data = 3;
function getme() {
return data;
}
return {
fdata: data,
me: getme
};
}();
Because, properties are deletable with delete property_name
. Will this break the programming pattern and is it a valid way of coding??.