added map function to js file