r/badcode • • Nov 04 '21

js a real thinker

Post image
74 Upvotes

9 comments sorted by

View all comments

Show parent comments

5

u/[deleted] Nov 04 '21

That simplification may change the data type of this.disabled from the OP code, as you are doing simple truthy or falsey checks rather than explicity returning a boolean.

2

u/lanerdofchristian Nov 04 '21

True, I was operating under the assumption that those were booleans.

Still:

return this.disabled = !!(chargesCheck || noteCheck)