Front end developer specialising in JavaScript and React. Experienced in all aspects of modern front end development. Passionate about making accessible, secure and performant software.
In short: Care about your work. Try to make your code readable. If you just attempt this as you work you are bound to take more steps towards that direction than if you don't.
Other than that, the answer is: apply standard programming principles.
The rest of the answer would be extremely long as entire books have been written on this topic. However, I would mostly suggest the following.
KISS + principle of least astonishment (things should work as you except) + good naming
Code should be as simple as possible. Not smart, no clever tricks. Think of your poor future self or colleague that will have to decipher your code tomorrow.
If you have good naming, and you trust your code works, you immediately (mostly) understand what a function does just by reading its name.
Single responsibility principle
Code should do one thing. When in doubt, lean towards extracting or refactoring additional concerns into separate functions with a descriptive name.
There are multiple benefits for this. The basic one is that it keeps functions short and readable.
Care about your work. Exactly! I've worked with different kind of developers, and I've seen that, readable code is coming from developers that like their job, otherwise... "I don't care, my code works".
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
In short: Care about your work. Try to make your code readable. If you just attempt this as you work you are bound to take more steps towards that direction than if you don't.
Other than that, the answer is: apply standard programming principles.
The rest of the answer would be extremely long as entire books have been written on this topic. However, I would mostly suggest the following.
KISS + principle of least astonishment (things should work as you except) + good naming
Single responsibility principle
Code should do one thing. When in doubt, lean towards extracting or refactoring additional concerns into separate functions with a descriptive name.
There are multiple benefits for this. The basic one is that it keeps functions short and readable.
And much more...
Care about your work. Exactly! I've worked with different kind of developers, and I've seen that, readable code is coming from developers that like their job, otherwise... "I don't care, my code works".