learning code modularization in js