Write js to file