changes in javascript object function