Do you have a sec?
A coworker who I don't get to work with much reached out this afternoon:
Hi, Avi! Do you happen to know javascript?
I replied... cautiously:
I... do.
/giphy backs away
We got to talking, as I always enjoy helping folks solve problems.
They were having some trouble with some client-side form validation. They're "not a coder" but had done some JS work in the past with a former manager and had some code sketched out. The logic made sense but something wasn't quite right.
Me: Have you ever used your browser's JS console?
Coworker: I haven't.
Me: Yay we're going to learn something today!!!
We walked through getting to the console and how to use it. We started evaluating some of the basic variable assignments in their code. They wanted to block submission of a form if two input
s were empty. One input was a text field and one was a checkbox. It turned out that they were using .value
to check the value of the checkbox, but I shared that... checkboxes are... strange.
We went on to fix the issue and discussed a few things:
.checked
gets the on/off state of a checkbox in JavaScript, not.value
- not all equalities are alike (or
==
!====
) - Chrome's JS debugger can be triggered with
debugger;
(which was something I'd forgotten!)
The form was fixed, the day was saved. We chatted a bit more and then signed off—having solved a problem, helped our clients, learned something new, and connected as humans where we otherwise might not have.
This is work that I enjoy doing.