How did I use AI today?
I had memorized the JavaScript code for the Class-Weekend-Boring assignment. Good - no problems there. But in playing around with the code, I wanted to put the variable outside of the function instead of inside the function to see what would happen. I knew how the code was supposed to work and that it worked correctly when the variable was inside the function. I took the variable outside of the function and the code didn't run correctly. Only the first value I input would be seen after clicking the check button. So I cut and paste all of that code (the correct version) into chatGPT and asked it why does this not work when the const is outside of the function. I told it to explain it as if I were a middle school student in the United States. Did I understand the concept better after I read its explanation?
Yes.
If the const is put before the function then whatever variable value is first input will be the only value that it reads so in a sense if you have the constant outside of the function it's kind of a set-and-forget situation and it won't change. But inside the function, it will reset when a new value is put in. So this helps me solidify the concept for future use (where do I put this puzzle piece - inside or outside?). I'm excited about it, because I don't have to do so much typing and hunting and pecking and reading. I can ask it a detailed question and it can give me an explanation, so I feel like I have a tutor right here that I can access at any time (like at 4 am). This is super helpful because you can ask it for basic explanations as you play around with your code.
So because of this query, I understand the concept better. Basic, yes, but one step forward. And the coolest thing is if you don't understand the concept that's being explained to you, or a part of it, you can ask it follow-up questions and it understands the prior conversation to move forward. So I'm finding this much more helpful than only searching or googling things.