add map function in js code