Javascript add attribute to object