added map to javascript function.