how to write javascript