adding functional js