#How can my code get cleaner

4 messages · Page 1 of 1 (latest)

livid orbit
soft arch
#

So it's pretty clean already, but a few ideas are to extract the anonymous function out into a declared function. You can also break out the function into multiple functions, one that calculates, one that sets the innerHTML.

#

And the calculate function can take params and then calculate the * & / and return values, so then you can have 1 function and just call it 3 times with different params

#

let me know if thats not clear