Create Map From Array Javascript Function