To write JavaScript, use a code editor to create .js files and write code using its syntax and programming structures.