success in changing to object javascript