Update Existing Object In Array Javascript Function Definition