separate map operations javascript