JavaScript piping work