CodeSOD: Mid-Stream Switch
by Ellis Morning from The Daily WTF on (#VPNC)
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
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!