News for hackers. Stuff that matters.
Re:How to manage HTML DOM with vanilla JavaScript only? by z3t4 on Friday April 03, 2020 @02:31AM (#22766749)
A trick I use to make the JS code more maintainable is to wrap code into pure functions that returns an element. For example if you need an input that only accept numbers: var input = makeInputThatOnlyAcceptNumbers() where the function returns the element, and all nitty gritty state handling is done inside the function.

There are no comments on this comment yet.