JavaScript for Merging data