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();="" }="">

James explains: "writeData() is a function that writes to Excel given the specified range and data. So it looks like she started with an iterative approach, but in the middle switched to a non-iterative one, but left the half-finished iterative code in. I'm speechless."

[Advertisement] Release! is a light card game about software and the people who make it. Play with 2-5 people, or up to 10 with two copies - only $9.95 shipped!