Javascript generator study