Javascript Modify Array Element Restructuring Debt