javascript constructor return different object