Submitter James writes: "I'm working on a project that has as one of its components a Microsoft App for Excel 2013. My team lead wrote most of the app up to this point, and I'm adding features. While exploring her code, I ran into this little gem (in JavaScript):"
function ClearData() {
var spn = document.getElementById("spntest");
spn.innerHTML = "";
var def = $.Deferred();
var arBlankMiddle = new Array();
var arNull = new Array();
arNull.push(0);
spn.innerHTML = "";
for (var i = 1; i <= 50; i++) {
arBlankMiddle.push([0]);
}
spn.innerHTML = "";
var arBlank = new Array();
// arBlank.push(arBlankMiddle);
arBlank = [[""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""], [""]];
spn.innerHTML = "";
$.when(writeData("A1:A50", arBlank), writeData("B1:B50", arBlank), writeData("C1:C50", arBlank), writeData("D1:D50", arBlank), writeData("E1:E50", arBlank), writeData("F1:F50", arBlank), writeData("G1:G50", arBlank), writeData("H1:H50", arBlank), writeData("I1:I50", arBlank), writeData("J1:J50", arBlank), writeData("K1:K50", arBlank), writeData("L1:L50", arBlank), writeData("M1:M50", arBlank), writeData("N1:N50", arBlank)).done(function (res1, res2, res3, res4, res5, res6, res7, res8, res9, res10, res11, res12, res13, res14) {
spn.innerHTML = "";
def.resolve();
});
//$.when(writeData("A1:A50", arBlank)).done(function (res1) {
// def.resolve();
//});
return def.promise();
}