write modular javascript